The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Mortality » Coding missing or dots (.) in STATA
Coding missing or dots (.) in STATA [message #20361] Mon, 26 October 2020 09:38 Go to next message
shujaat.smc@gmail.com is currently offline  shujaat.smc@gmail.com
Messages: 75
Registered: July 2020
Senior Member
Dear DHS Representative,

I have a question about the following Stata command that I copied from Git-Hub;


//tetnaus toxoid injections
recode m1_1 (0 1 8 9 . = 0 "no") (1/7 = 1 "yes"), gen(rh_anc_toxinj)
recode m1_1 (0 1 8 9 . = 0 "No") (1/7 = 1 "Yes"), gen(rh_anc_toxinj)
replace rh_anc_toxinj = . if age>=period
label var rh_anc_toxinj "Received 2+ tetanus injections during last pregnancy"


Q; Is this is permissible that labeling the dots (.) which stata shows as "missing" in its codebook command, that we assign the value of zero since zero in many cases is code by the researcher for the reference category. Therefore using zero for dots (.)
is like having response No from the participants in the survey even though most of them either not answered a particular question or the question was skipped according to the questionnaire tools.

Q; In one of the responses I got on the DHS forum was to code dots as "." (how this coding works in stata) since despite using this code if we tab newly generated variable still it shows missing observation in it similar to parent variable.

Waiting for your reply.

Best Regards

Dr. Hussain


Re: Coding missing or dots (.) in STATA [message #20371 is a reply to message #20361] Mon, 26 October 2020 12:43 Go to previous messageGo to next message
Shireen-DHS is currently offline  Shireen-DHS
Messages: 140
Registered: August 2020
Location: USA
Senior Member
Hello,

Yes the dot in this case (or missing values) can be coded as zero. For this indicator missing values are considered to have no tetanus injection.

I did not understand your second question.

Best,

Shireen Assaf
The DHS Program
Re: Coding missing or dots (.) in STATA [message #20379 is a reply to message #20371] Mon, 26 October 2020 13:41 Go to previous messageGo to next message
shujaat.smc@gmail.com is currently offline  shujaat.smc@gmail.com
Messages: 75
Registered: July 2020
Senior Member
Dear Shireen,

Thanks for your reply.

My 2nd Question rephrase; If I have a variable in DHS Stata file eg "Vaccine status" and it is binary coded yes=1 & no=0 along with some missing observations for this variable.

I am recording it as follow;

recode vaccine-status (1=1 "received-Vac") (0=0 "not-vac") (.="."), gen(vac)

What I have an understanding that coding dot(.) as "." does not allow the stata to assign a large value to miss observations (.), thus all-new variables that are re-coded in which dots (.) are given code "." (dot in inverted comas) gives unbiased estimates when used for cross-tabulations and building regression models.

Best Regards

Dr. Hussain




Re: Coding missing or dots (.) in STATA [message #20381 is a reply to message #20379] Mon, 26 October 2020 13:59 Go to previous messageGo to next message
Shireen-DHS is currently offline  Shireen-DHS
Messages: 140
Registered: August 2020
Location: USA
Senior Member
Hello,

The code (.=".") is not correct. If you meant (.=.) this actually would not do anything in your code. Missing values in DHS data are coded as 9 or 99 or 999 depending on the variable so you would use (9=. ). You do not attach a label to dots.

For cross-tabulation and regression models, the missing would be automatically excluded when running these tests in Stata. You would of course need to use weights and account for sample survey design for any statistical analysis using the svy commands in Stata.

Good luck.

Shireen
Re: Coding missing or dots (.) in STATA [message #20382 is a reply to message #20381] Mon, 26 October 2020 14:05 Go to previous message
shujaat.smc@gmail.com is currently offline  shujaat.smc@gmail.com
Messages: 75
Registered: July 2020
Senior Member
Dear Shireen,

Thanks a lot for clearing my misunderstanding.

Best Regards

Dr. Hussain

Previous Topic: Who Provide the Delivery Care
Next Topic: Place of Death of Children Or Neonates
Goto Forum:
  


Current Time: Sun Dec 22 16:10:45 Coordinated Universal Time 2024