Lab 3 posted

Lab 3 posted

by Mark Pletcher -
Number of replies: 2

This is one of the longer labs in the course, so might want to get started before Tuesday.

Also, a reminder, we won't be bringing printouts.  If you want one, print it before you come.

In reply to Mark Pletcher

Re: Lab 3 posted

by Aparna -

In an attempt to get started, I got stuck at recoding the gender variable.  Once you create a new variable female and make that = 0. In the survey, male=1 and female =2 so when writing the command, do you replace female=1 if genderp in the survey == "2"?

Subsequently, once that's created for the "9" instead of "" for missing variables, do you just use == 9?

 

 

In reply to Aparna

Re: Lab 3 posted

by Dawn Gano -

Sorry for the delayed reply to your question.

genderp==2 indicates female sex, so you are correct that you need to replace female=1 if genderp==2.

To find missing values in your 2 X 2 table, enter the code: tab genderp female, missing. In this survey, a response of 9 indicates a missing value. In Stata,  .  indicates a missing value. You need to replace the values with a 9 and  . as missing  in the new female variable. To do this, enter: replace female=. if genderp==9|genderp==. (translation: replace female as missing if genderp is 9 or missing)