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: Unexpected behavior from svy: proportion
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: Unexpected behavior from svy: proportion
Date
Wed, 27 Mar 2013 14:18:10 -0400
Jennifer F. Sabatier (CDC/CGH/DGHA) <[email protected]>:
But don't use -svy: mean- or -svy: proportion- as those can give CI
including zero or one. Stick with -svy: tab- (check out the manual
entries for more detail on how the calculations are done, using a
logit transformation).
On Wed, Mar 27, 2013 at 2:14 PM, Nick Cox <[email protected]> wrote:
> Check to see if -colvar- is a string variable. If it is, try -destring-.
>
> Nick
>
> On Wed, Mar 27, 2013 at 6:07 PM, Sabatier, Jennifer F. (CDC/CGH/DGHA)
> <[email protected]> wrote:
>>
>>
>> I am trying to get simple proportions and confidence intervals and sample frequencies from a subpopulation in survey data.
>>
>>
>> So far this works:
>>
>> svy, subpop(if subpop1==1 & subpop2 == 1 & subpop3 == 1): tab rowvar colvar, ci per col obs missing nolabel
>>
>> Then I saw I could use svy: prop. I'm a very novice user, by the way, though I am very skilled in SAS and R. R is my go-to program and I use it most of all. But a lot of my collaborators use Stata so I translate code when necessary, and will perform analyses in Stata if asked. I mention all of that so you'll know I am not totally unfamiliar with statistical programming.
>>
>> In this case, the original code was in SAS:
>>
>> proc surveyfreq data=dta missing;
>> cluster psu;
>> weight wght;
>> tables subpop1*subpop2*subpop3*rowvar*colvar / cl(type=logit) col;
>> run;
>>
>>
>> So, the svy: tab code gives me very similar results as proc surveyfreq. One thing that's different is the while they both give the same SE, the confidence intervals in Stata are slightly narrower than those from SAS. But that's not why I'm here.
>>
>> A colleague of mine who uses Stata regularly advised I try svy:prop. So I did and I failed.
>>
>>
>> This is the code:
>>
>> svy: mean colvar , over(subpop1 subpop2 subpop3 rowvar)
>>
>> But it doesn't work. I get this error:
>>
>> no observations
>> r(2000);
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/