Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: mean2 not allowing if or weight options
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: mean2 not allowing if or weight options
Date
Mon, 3 Oct 2011 16:42:26 +0100
Part of this is easy: Look inside at the code, and you will see that the -syntax- statement of -mean2- is
syntax varlist(min=2) using/, over(str asis) CATegory(str asis) /*
*/ [svy * vce(str asis) CLuster(str asis)] replace
which rules out -if- or -in- restrictions and the use of weights.
Evidently Roy intended to implement these features but has yet not done so, at least in the public version on SSC. If you want these features implemented properly, you should write to him, as he is not a member of Statalist.
If you wish to run -mean2- on a subset of the data, you can do this
preserve
keep [if] [in]
mean2
restore
Nick
[email protected]
Ariel Linden, DrPH
After seeing a posting last week on this listserve about mean2 (a program
written by Roy Wada -findit mean2-) I tried it out and found it to be quite
useful. That said, it does not appear to allow either 'if' statements or
weights. The help file states the program accommodates both if and weight
options.
I made sure all the other programs it relies on are up-to-date so that does
not appear to be the issue. Also, I am using version 12.0.
This works:
mean2 price mpg weight using myfile.txt, over(foreign) cat(Domestic
Foreign) excel replace
(output not shown)
This doesn't work:
mean2 price mpg weight using myfile.txt if rep78 >3, over(foreign)
cat(Domestic Foreign) excel replace
if not allowed
This doesn't work:
mean2 price mpg weight using myfile.txt [pw=length], over(foreign)
cat(Domestic Foreign) excel replace
weights not allowed
Any help would be appreciated!
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/