Stata output files in surveys

Posted by William Shakespeare on Stack Overflow See other posts from Stack Overflow or by William Shakespeare
Published on 2013-10-25T17:47:48Z Indexed on 2013/10/26 21:55 UTC
Read the original article Hit count: 285

Filed under:
|
|

I have some survey data which I'm using Stata to analyze. I want to compute means of one variable by group and save those means to a Stata file. My code looks like this:

svyset [iw=wtsupp], sdrweight(repwtp1-repwtp160) vce(sdr)
svy: mean x

I tried

svy: by grp: mean x

but that did not work. I could save each mean to a separate file by simply saying

svy: mean x if grp==1

but that's inefficient. Is there a better way?

Saving results to a file like one can use SAS ODS to capture results is also a need. I am not talking about the log here. I need the means and the associated group. I'm thinking

estimates save [path],replace

but I'm not sure if that will give me a Stata file or the group if I can figure out how to use by processing.

© Stack Overflow or respective owner

Related posts about stata

Related posts about results