The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » Svy command, r(2000) error message, NFHS-3 India
Svy command, r(2000) error message, NFHS-3 India [message #4427] Tue, 26 May 2015 06:14 Go to next message
RenaM is currently offline  RenaM
Messages: 6
Registered: May 2015
Member
Dear fellow users,

I use NFHS-3 (DHS India 2005-6), the children's file + women's domestic violence variables, and set up the survey variables in Stata accordingly, following
http://dhsprogram.com/faq.cfm and
http://userforum.dhsprogram.com/index.php?t=msg&th=1217& amp;start=0&S=221608a0f19ba7cd3b19146ec73a3903 :

gen weight=v005/1000000
egen strata = group(v024 v025), label
tab strata

svyset [pweight=weight], psu(v021) strata(strata)

Now, I would like to calculate statistics using the svy: commands, including svy: mean.

I ran for example, just to see if it works:

svy: mean hw70 (hw70 is Height for age standard deviation)
svy: mean hw1 (age in months)

Every time I do this, I get the following error message:

(running mean on estimation sample)
no observations
r(2000);

I researched online in stata forums as well as in this forum and could not find any useful hints.

Thank you very much for giving me advice.
Re: Svy command, r(2000) error message, NFHS-3 India [message #4431 is a reply to message #4427] Tue, 26 May 2015 08:24 Go to previous messageGo to next message
RenaM is currently offline  RenaM
Messages: 6
Registered: May 2015
Member
Just solved the problem myself, but cannot delete my post.

Solution:

The variable v021 does not contain any values. Instead, s021 needs to be used.
Re: Svy command, r(2000) error message, NFHS-3 India [message #5438 is a reply to message #4427] Wed, 27 May 2015 07:13 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Here are comments fron Senior DHS Stata Specialist, Tom Pullum:

The children's variables are in the KR file and the domestic violence variables (d*) are in the IR file. You must have done a merge, and I suspect that your problem is with the merge. Sometimes a merge can end up with an empty file. How many cases do you have in the merged file? Can you calculate the desired means WITHOUT the svy command?

Another comment. The pweight option does not require that you divide v005 by 1,000,000. Pweights are automatically normalized to have a mean of one. You could multiply or divide v005 by any number whatever, and it would not alter the results.


Re: Svy command, r(2000) error message, NFHS-3 India [message #10576 is a reply to message #5438] Fri, 12 August 2016 00:16 Go to previous messageGo to next message
bijetri is currently offline  bijetri
Messages: 2
Registered: August 2016
Member
Hi,

I am using a dataset with the children's files from the 3 waves appended (NFHS India -1,2,3). I need to setup the survey variables in Stata using svyset.
However, I am unsure about which variable to set as psu.

v021 has information for waves 1 and 2 whereas the information for wave 3 is in s021. However, the values of these 2 variables are not comparable.

For example:
v021 s021 v000
--------------------
37. 4 . IA2
39. 6 . IA2
54. 11 . IA2

63. 1 . IA3
66. 1 . IA3

1. . 1001 IA5
2. . 1001 IA5

I have been trying to figure out whether I can recode these variables to match but having very little experience with svy, I am not sure on how to proceed.
Any help will be much appreciated.

Thank you


Re: Svy command, r(2000) error message, NFHS-3 India [message #10595 is a reply to message #10576] Mon, 15 August 2016 08:30 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:


I don't know what variable you are using for "wave" but I will give it the name "wave", and assume it has the values 1, 2, and 3.

I suggest the following lines in the combined file:

gen v021_rev=v021
replace v021_rev=s021 if wave==3
egen cluster=group(wave v021)

You can then use "cluster" as the psu in the svyset command. It will not matter that the numbering scheme is different in the three waves, so long as they are all numeric.

Re: Svy command, r(2000) error message, NFHS-3 India [message #10602 is a reply to message #10595] Tue, 16 August 2016 01:05 Go to previous message
bijetri is currently offline  bijetri
Messages: 2
Registered: August 2016
Member
Thank you.
Previous Topic: weighting for Services Provision Assessment data
Next Topic: Performing a manual backward stepwise logistic regression in Stata
Goto Forum:
  


Current Time: Thu Mar 28 09:14:13 Coordinated Universal Time 2024