Using the "SVY" module and sampling weights of STATA GUATEMALA [message #13566] |
Mon, 20 November 2017 11:47 ![Go to next message Go to next message](/theme/default/images/down.png) |
MMazariegos
Messages: 1 Registered: November 2017 Location: Mexico
|
Member |
|
|
Good morning,
I am using the DHS 2014-2015 Guatemala Database: GUIR71FL
I just want to be sure if I am using the correct variables to specify the SVY, can you please check the code above?
use "C:\Users\mmazariegos\Desktop\ENSMI 2015\GUKR71FL.DTA"
svyset v021 [pweight = v022], strata(v023) singleunit(centered)
Also, I do not know if I have to do it anything else to be able to calculate proportions of some variable over other. For example, the proportion of stunting over wealth status.
First, I calculate stunting:
*To generate STUNTING*
sum hw70
gen haz= hw70/100
sum haz
replace haz=. if haz<-6
replace haz=. if haz>6
gen stunting= 1 if haz <-2 & (hw1<60 & hw1!=.)
replace stunting= 0 if haz >=-2 & (hw1<60 & hw1!=.)
tab stunting, gen(stunting_cat)
*Stunting by wealth Index*
tab v190
svy:proportion stunting, over(v190) *This is working*
But I want to calculate not only the proportion by wealth status but be able to assess if there are statistical differences using lincom:
svy, subpop(keeptag): mean stuntingcat, over(v190)
lincom [_subpop_1] - [_subpop_2]
lincom [_subpop_1] - [_subpop_3]
lincom [_subpop_2] - [_subpop_3]
With this, I get an error saying "invalid subpop() option"
Thanks in advance,
Monica
|
|
|
Re: Using the "SVY" module and sampling weights of STATA GUATEMALA [message #13830 is a reply to message #13566] |
Mon, 08 January 2018 15:31 ![Go to previous message Go to previous message](/theme/default/images/up.png) |
Bridgette-DHS
Messages: 3151 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS Stata Specialist, Tom Pullum:
We apologize for the long delay with this response. You have probably already found an answer.
You do not include your definition of "keeptag", as in "subpop(keeptag)". When I have had the error statement you mention, it has been because of an improper specification of the argument of subpop. Here, the data will be reduced to the cases with keeptag=1. You must define the argument so that it takes the value 1 for the cases you want to include. For other cases, you assign keeptag=0 or keeptag=. At least that's how I always specify the subpopulation.
I have never used subpop followed by lincom. It is possible that you also need to explicitly limit the cases for which lincom is applied to the cases with keeptag=1. However, I doubt that that is the problem.
|
|
|