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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: Unexpected behavior from svy: proportion


From   "Sabatier, Jennifer F. (CDC/CGH/DGHA)" <fvv9@cdc.gov>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Unexpected behavior from svy: proportion
Date   Wed, 27 Mar 2013 18:07:32 +0000


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);

Where error 2000 is:

error . . . . . . . . . . . . . . . . . . . . . . . . Return code 2000
        no observations;
        You have requested some statistical calculation and there are
        no observations on which to perform it.  Perhaps you specified
        if or in and inadvertently filtered all the data.

So, I am obviously not understanding how to do this.  My  colleague isn't around to help me so I thought I'd turn here.  Can someone help me replicate the proc surveyfreq and/or the svy: tab using svy: prop?

Best,

Jen






*
*   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/


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