Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: st: RE: mean2 not allowing if or weight options


From   "Ariel Linden, DrPH" <ariel.linden@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   re: st: RE: mean2 not allowing if or weight options
Date   Tue, 4 Oct 2011 10:27:15 -0400

Thanks Nick.

I did email Roy and he quite graciously provided me with updated versions of
mean2 and outreg2 (which is a necessary ingredient in running mean2). 

I assume he'll provide the update to SSC, but I told him that I posted here
and he might be hearing from other listers...

Ariel

Date: Mon, 3 Oct 2011 16:42:26 +0100
From: Nick Cox <n.j.cox@durham.ac.uk>
Subject: st: RE: mean2 not allowing if or weight options

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 
n.j.cox@durham.ac.uk 

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index