Bookmark and Share

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]

Re: st: Domain analysis of survey data


From   "G. Dai" <[email protected]>
To   [email protected]
Subject   Re: st: Domain analysis of survey data
Date   Fri, 16 Jul 2010 16:14:25 -0700

One clarity first. Can't use if statement in a survey because it kills
the sample to sample variability of the survey design.
In the case, use subpop option after svy:
gen countyi=county==i
svy,sub(countyi): mean agegroup race education income maritalstatus
smokingstatus
hth
guang


On Fri, Jul 16, 2010 at 3:23 PM, Brad Cannell <[email protected]> wrote:
> Hello,
>
> I'm new to stata. I'm analyzing a large weighted state survey (Behavioral Risk Factor Surveillance System) to create a state report. In this report I need to do a separate descriptive table for each county in the state, which includes proportions of the county that fall into various different categories. In SAS I would have done it like this (hypothetical):
>
> proc surveyfreq data=statereport;
> table agegroup race education income maritalstatus smokingstatus;
> by county
> weight finalweight
> strata stratvar
> run;
>
> The "by county" because that is the command that would have repeated the frequency tables of age, race, education, etc for each county.
>
> So far in stata I have been able to designate the dataset as survey data with the correct weight and strata variables identified. I have also been able to produce frequency tables of age, race, education, etc for the dataset as a whole using "svy: prop age race education". However, after a lot of searching I am unable to find a way to get stata to give me a separate analysis for each county. I really don't want to use "if" statements to program the analysis for each county separately. When I try "by county: svy: prop age race education" I get an error message saying that by statements can't be used with survey commands. Does anyone have a suggestion?
>
> Thanks,
> Brad
> *
> *   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/
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index