Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Analysis on subset of Demographic and Health Survey (DHS) data

From   Friedrich Huebler <>
Subject   Re: st: Analysis on subset of Demographic and Health Survey (DHS) data
Date   Sun, 27 Oct 2013 09:22:14 -0400


Please have a look at the Statalist FAQ (link at the bottom of this
message). Some excerpts:

"The current version of Stata is 13.0. Please specify if you are using
an earlier version"

The fact that you use -set mem- indicates that you have Stata 11 or older.

"Say exactly what you typed and exactly what Stata typed (or did) in response."

I assume that you did not type "use TZKR62DT/TZKR62FL.DTA" because
that is not a valid filename in most operating systems. You also don't
explain why the command "keep if B9==0" is not recognized because you
omitted the output from Stata.

Now to your questions. The data for children under 5 from the Tanzania
DHS 2010 has only 8023 observations. It is not clear why you expect
8081 observations. The survey report, which you cite as reference, has
480 pages.

The command -keep if B9==0- will yield an error message because the
variable B9 doesn't exist in the data. Stata is case-sensitive and the
correct variable name is b9.


On Sat, Oct 26, 2013 at 12:53 PM, french Smith <> wrote:
> Dear STATA crowd,
> I wish to analyze the Demographic and Health Surveys (DHS) data on
> children under five.
> I have set up my analysis as follows, using at Tanzania DHS 2010 as a
> starting point. But I have two questions:
> 1. Why do I have 8,023 cases not the 8,081 that the report (the report
> and dataset are available at
> says exit?
> 2. How do I restrict the analysis to V465, which was a question asked
> only of respondents with a youngest child under five living with them?
> Maybe questions, sorry, but my STATA mind needs jogging!
> Thanks!
> French
> set mem 450m
> set matsize 800
> *v022 is sample stratum number
> gen stratid = v022
> *v021 is PSU
> gen psu = v021
> *v005 is sample weight
> gen weight = v005/1000000
> svyset psu [pw=weight], strata(stratid)
> *Just to compare totals. Should get 8,081 for Tanzania DHS 2010 not 8,023!
> tab stratid
> *keep if complete response
> keep if v015==1
> *keep if child lives with respondent. But this command isn’t recognized!
> keep if B9==0

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index