Dear all
I am using the PALMS dataset (Post-Apartheid Labour Market Survey) - it is a stacked crossed sectional dataset of the labour market dynamic survey in South Africa (and its predecessors) across the years 1994 to 2017. It is at the individual level.
I am wanting to create a variable for the number of children in the household under the ages of 7 (i.e. 'Young children present'). I gather you do this using the 'egen' command. There is a variable for the household and individual identifier.
The code that i have tried to run is:
egen Y_CHILD = count(personnr) if age <= 7 , by (uqnr)
* Counts number of young children in every uqnr (household identifier)
egen YChild = max (YCHILD), by (uqnr)
*Assigns total number of children to each individual within the same household
tab YChild
recode YChild (0/2=1 "1. 0 - 2 children") (3/4=2 "2. 3 - 4 children") (5/6=3 "3. 5 - 6 children") (7/max=4 "4. 7 or more children"), gen(YChild_cat)
label var YChild_cat "Categorical variable: Number of Young Children present in Household"
*Assess years
tab YChild_cat if year == 2007
tab YChild_cat if year == 2012
tab YChild_cat if year == 2017
However, this does not produce the desired result. I believe i am missing something fundamental about the egen command.
Could anyone help?
Related Posts with Number of children in household variable from individual level dataset
diffrents values about swekness and kurtosis "with summv1, det" and "sktest v1"Good morning. Because the "summ v1, det" and "sktest v1" commands showed different values about swek…
Global Search Regression "__000006 not found"Dear statalisters, I'm usinsg Stata 14, and trying to use the command gsreg to select the variables…
re-run the entire do file with different data (different years)Hello, I have written a do file with all the codes I need to conduct the tests I want for a year (a…
Use of multiple imputation for missing values of binary outcome componentsDear Statalisters, I'm using Stata 17.0. I have a composite outcome: in particular, the 3 componen…
Generate random points around a centroid in circleHi everyone, I am struggling to generate random points around a fixed point (defined by latitude an…
Subscribe to:
Post Comments (Atom)
0 Response to Number of children in household variable from individual level dataset
Post a Comment