/*In this section, I take measures from the NICHD SECCYD demographic file at age 54 months to make comparisons with the ECLS-K dataset. Some variables will come from the "seccyd_marshmallow" dataset created in the "1. Marshmallow Data Set Up.do" file. Variables created here: Table 1 Name Syntax Name ------------ ------------- Mother Unemployed mom_unemp54 Number of Children in Home childinhome54 Mother Married married54 Mother's Education Did Not Complete High School momed_nohs Graduated from High School momed_hs Some College momed_somecol Bachelor's Degree momed_bamore Income to Needs Ratio Income/Needs <=1 inc1 Income/Needs >1 & <=2 inc2 Income/Needs >2 & <=3 inc3 Income/Needs >3 & <=4 inc4 Income/Needs >4 inc5 *Not listed, but used to make "inc" dummies: Income at age 54 months income54 Datasets used include demo54, seccyd_marshmallow */ use raw_data/demo54.dta, clear *making all variables lowercase foreach var of varlist id- MOCCUM54 { rename `var' `=lower("`var'")' } *** Income at age 54 Months *** rename incntm54 income54 sum income54 *M= 3.59; SD=3.17; N=1073 *** Mother Unemployed *** gen mom_unemp54=. replace mom_unemp54=1 if mempsm54==0 replace mom_unemp54=0 if mempsm54==1 tab mom_unemp54 *297 coded as "1"; 28% *** Number of Children in Home *** rename chldnm54 childinhome54 sum childinhome54 *M= 2.27; SD= 0.98; N=1084 *** Mother Married *** codebook mstatm54 *see CCDR212- mothers set to "1" are married and living with their partner recode mstatm54 (2 3 4 5 6 = 0) rename mstatm54 married54 tab married54 *835 coded to "1"; 77.03% keep id income54 mom_unemp54 childinhome54 married54 save data/seccyd_6.dta, replace *Merge Onto Full Dataset use data/seccyd_marshmallow.dta, clear merge 1:1 id using data/seccyd_6.dta drop _merge *Generating Sample Variables gen sample1=. replace sample1=1 if dog_min!=. & (ach1!=. | ach15!=.) & (beh1!=. | beh15!=.) *918 gen sample2=. replace sample2=1 if momed<=14 & sample1==1 *552 gen sample3=. replace sample3 = 1 if momed>14 & momed!=. & sample1==1 *366 *** Mother Education Dummy Categories *** gen momed_nohs=. replace momed_nohs=1 if momed<12 replace momed_nohs=0 if momed>=12 & momed!=. gen momed_hs=. replace momed_hs=1 if momed==12 replace momed_hs=0 if momed!=12 & momed!=. gen momed_somecol=. replace momed_somecol=1 if momed==14 replace momed_somecol=0 if momed!=14 & momed!=. gen momed_bamore=. replace momed_bamore=1 if momed>=16 & momed!=. replace momed_bamore=0 if momed<16 tab1 momed_* *No high school - 139 coded "1"; 10.20% *high school - 287 coded "1"; 21.06% *some college- 455 coded "1"; 33.38% *BA or more - 482 coded "1"; 35.36% *** Income to Needs Dummies *** gen inc1=. replace inc1=1 if income54 <=1 replace inc1=0 if inc1!=1 & income54!=. gen inc2=. replace inc2=1 if income54 <=2 & income54 > 1 & income54!=. replace inc2=0 if inc2!=1 & income54!=. gen inc3=. replace inc3=1 if income54 <=3 & income54 > 2 & income54!=. replace inc3=0 if inc3!=1 & income54!=. gen inc4=. replace inc4=1 if income54 <=4 & income54 > 3 & income54!=. replace inc4=0 if inc4!=1 & income54!=. gen inc5=. replace inc5=1 if income54 > 4 & income54!=. replace inc5=0 if inc5!=1 & income54!=. tab1 inc1 inc2 inc3 inc4 inc5 *inc1 - 127 coded "1"; 11.84% *inc2- 204 coded "1"; 19.01% *inc3- 231 coded "1"; 21.53% *inc4- 180 coded "1"; 16.78% *inc5- 331 coded "1"; 30.85% est clear estpost sum male dblack dhisp dwhite momage momed_nohs momed_hs momed_somecol /// momed_bamore inc1 inc2 inc3 inc4 inc5 mom_unemp54 childinhome54 married54 if sample2==1 est store m1 estpost sum male dblack dhisp dwhite momage momed_nohs momed_hs momed_somecol /// momed_bamore inc1 inc2 inc3 inc4 inc5 mom_unemp54 childinhome54 married54 if sample3==1 est store m2 esttab * using tables/table1_seccyd.csv, main(mean) aux(sd) b(2) replace label nogaps *------------------------------------------------------------------------------* *----------------------- ECLSK DATASET ----------------------------------------* *------------------------------------------------------------------------------* /*This section of the file cleans the ECLS-K dataset. This dataset was downloaded from https://nces.ed.gov/ecls/dataproducts.asp The files were downloaded for Stata, and I combined the 6 files into one dataset called "eclsk1998_full.dta" Because the dataset is so large, I started by renaming the variables used for Table 1, then I pared down the dataset to only include these variables before cleaning. The process used to create the "income to needs ratio" measure is described below with the syntax. Table 1 Name Syntax Name ------------ ------------- Male male Black dblack Hispanic dhisp White dwhite Mother's Age at Child Birth momagebirth Mother's Education Did Not Complete High School momed_nohs Graduated from High School momed_hs Some College momed_somecol Bachelor's Degree momed_bamore Income to Needs Ratio Income/Needs <=1 inc1 Income/Needs >1 & <=2 inc2 Income/Needs >2 & <=3 inc3 Income/Needs >3 & <=4 inc4 Income/Needs >4 inc5 Mother Unemployed dmom_employ_unemp Number of Children in Home num_l18 Mother Married parentmarried *Not listed, but used to make "inc" dummies: Income income_cat_imp Total num in household num_house Total adults in household num_o18 *Not listed, but used to make "mother's age at child birth": Child age r1_kage Child Weight (not listed) C1CW0 */ use raw_data/eclsk1998_full.dta, clear rename CHILDID id rename GENDER gender rename RACE race rename P1HMAGE momage rename WKMOMED momed rename W1INCCAT income_cat_imp rename P1HMEMP mom_employ rename P1HTOTAL num_house rename P1LESS18 num_l18 rename P1OVER18 num_o18 rename W1MOMAR parentmarried rename C1CW0 c1cw0 rename R1_KAGE r1_kage keep id gender race momage momed income_cat_imp mom_employ num_house num_l18 /// num_o18 parentmarried c1cw0 r1_kage *** Male *** codebook gender replace gender=. if gender == -9 recode gender 2=0 tab gender rename gender male tab male *10,950 coded "1"; 51.18% *** Race *** gen dwhite=. replace dwhite=1 if race==1 replace dwhite=0 if race!=1 & race!=. tab dwhite, missing gen dblack=. replace dblack=1 if race==2 replace dblack=0 if race!=2 & race!=. tab dblack, missing gen dhisp=. replace dhisp=1 if race==3 | race==4 replace dhisp=0 if race!=3 & race!=4 & race!=. tab dhisp, missing tab1 dwhite dblack dhisp *white= 11,788; 55.06% *black= 3,224; 15.06% *hisp= 3,826; 17.87% *** Mother's Age at Child's Birth *** tab momage codebook momage *1 case= 0; 3 cases=2; 2 cases=5; missing coded as negative values drop if momage<18 gen momagebirth=. replace momagebirth= momage - (r1_kage/12) sum momagebirth *M=27.70; SD=6.67; N=17,716 *** Mother Unemployed *** codebook mom_employ replace mom_employ=. if mom_employ<0 gen dmom_employ_unemp=. replace dmom_employ_unemp= 1 if mom_employ==3 | mom_employ==4 replace dmom_employ_unemp= 0 if mom_employ!=3 & mom_employ!=4 & mom_employ !=. tab dmom_employ_unemp *5,779 coded "1"; 32.86% *** Parent Married *** tab parentmarried replace parentmarried=. if parentmarried<0 recode parentmarried 2 = 0 tab parentmarried *11,049 coded "1"; 71.22% *** Mother Education *** codebook momed replace momed=. if momed<0 gen momed_nohs=. replace momed_nohs=1 if momed==1 | momed==2 replace momed_nohs=0 if momed!=1 & momed!=2 & momed!=. tab momed_nohs, missing gen momed_hs=. replace momed_hs=1 if momed==3 replace momed_hs=0 if momed!=3 & momed!=. tab momed_hs, missing gen momed_somecol=. replace momed_somecol=1 if momed==4 | momed==5 replace momed_somecol=0 if momed_somecol!=1 & momed!=. tab momed_somecol, missing gen momed_bamore=. replace momed_bamore=1 if momed>=6 & momed!=. replace momed_bamore=0 if momed <6 tab1 momed_* *No High School- 2,809; 14.25% *High School - 5,954; 30.21% *Some college- 6,337; 32.15% *BA or more- 4,609; 23.39% *** INCOME TO NEEDS RATIO *** *Convert Income to Continuous Variable tab income_cat_imp, missing gen income=2500 forvalues i = 2/9 { local j = `i' - 1 replace income= income + (5000 * `j') if income_cat_imp==`i' } replace income= 62500 if income_cat_imp==10 replace income= 87500 if income_cat_imp==11 replace income= 150000 if income_cat_imp==12 replace income= 200001 if income_cat_imp==13 replace income=. if income_cat_imp==. sum income tab income tab income_cat_imp *Income to Needs Ratio Based on 1997 Categories codebook num_house num_l18 gen famunit=. replace famunit=num_house replace famunit=9 if num_house>=9 & num_house!=. sum famunit *M= 4.52; SD= 1.33; N= 17,716 gen childinhome=. replace childinhome= num_l18 replace childinhome= 8 if num_l18>=8 & num_l18!=. *Federal pov threshold is capped at 8 children in home sum childinhome *M= 2.49; SD= 1.17; N= 17,716 /* These poverty line calculations come from the Census Bureau, which sets poverty level threshholds each year based on income, family size, and the number of children in the home. We used 1997 for these calculations, and the table containing these values can be found here: https://www.census.gov/data/tables/time-series/demo/income-poverty/historical-poverty-thresholds.html */ gen incomeneeds1=. replace incomeneeds1 =11021 if famunit == 2 & childinhome==1 replace incomeneeds1 =12919 if famunit == 3 & childinhome==1 replace incomeneeds1 =12931 if famunit == 3 & childinhome==2 replace incomeneeds1 =16825 if famunit == 4 & childinhome==1 replace incomeneeds1 =16276 if famunit == 4 & childinhome==2 replace incomeneeds1 =16333 if famunit == 4 & childinhome==3 replace incomeneeds1 =20255 if famunit == 5 & childinhome==1 replace incomeneeds1 =19634 if famunit == 5 & childinhome==2 replace incomeneeds1 =19154 if famunit == 5 & childinhome==3 replace incomeneeds1 =18861 if famunit == 5 & childinhome==4 replace incomeneeds1 =23053 if famunit == 6 & childinhome==1 replace incomeneeds1 =22578 if famunit == 6 & childinhome==2 replace incomeneeds1 =22123 if famunit == 6 & childinhome==3 replace incomeneeds1 =21446 if famunit == 6 & childinhome==4 replace incomeneeds1 =21045 if famunit == 6 & childinhome==5 replace incomeneeds1 =26586 if famunit == 7 & childinhome==1 replace incomeneeds1 =26017 if famunit == 7 & childinhome==2 replace incomeneeds1 =25621 if famunit == 7 & childinhome==3 replace incomeneeds1 =24882 if famunit == 7 & childinhome==4 replace incomeneeds1 =24021 if famunit == 7 & childinhome==5 replace incomeneeds1 =23076 if famunit == 7 & childinhome==6 replace incomeneeds1 =29811 if famunit == 8 & childinhome==1 replace incomeneeds1 =29274 if famunit == 8 & childinhome==2 replace incomeneeds1 =28804 if famunit == 8 & childinhome==3 replace incomeneeds1 =28137 if famunit == 8 & childinhome==4 replace incomeneeds1 =27290 if famunit == 8 & childinhome==5 replace incomeneeds1 =26409 if famunit == 8 & childinhome==6 replace incomeneeds1 =26185 if famunit == 8 & childinhome==7 replace incomeneeds1 =35719 if famunit == 9 & childinhome==1 replace incomeneeds1 =35244 if famunit == 9 & childinhome==2 replace incomeneeds1 =34845 if famunit == 9 & childinhome==3 replace incomeneeds1 =34190 if famunit == 9 & childinhome==4 replace incomeneeds1 =33289 if famunit == 9 & childinhome==5 replace incomeneeds1 =32474 if famunit == 9 & childinhome==6 replace incomeneeds1 =32272 if famunit == 9 & childinhome==7 replace incomeneeds1 =31029 if famunit == 9 & childinhome==8 gen incometoneeds=. replace incometoneeds = income/incomeneeds1 sum incometoneeds *M=3.29; SD= 2.75; N=13,779 *hist incometoneeds /*The ECLS-K Base Year documentation also contains suggested thresholds, but they have less specificity. Will create an alternate version using these values to cross check "incometoneeds" Chart provided in Table 7-2 of https://nces.ed.gov/pubs2001/2001029rev.pdf */ gen incomeneeds2=. replace incomeneeds2= 10973 if famunit==2 replace incomeneeds2= 13001 if famunit==3 replace incomeneeds2= 16655 if famunit==4 replace incomeneeds2= 19682 if famunit==5 replace incomeneeds2= 22227 if famunit==6 replace incomeneeds2= 25188 if famunit==7 replace incomeneeds2= 28023 if famunit==8 replace incomeneeds2= 33073 if famunit==9 gen incometoneeds2=. replace incometoneeds2= income/incomeneeds2 sum incometoneeds2 *M=3.22; SD= 2.70; N=13,779 *very close to first calculation corr incometoneeds incometoneeds2 *r=0.9998 *** Income to Needs Dummies *** gen inc1=. replace inc1=1 if incometoneeds <=1 replace inc1=0 if inc1!=1 & incometoneeds!=. gen inc2=. replace inc2=1 if incometoneeds <=2 & incometoneeds > 1 & incometoneeds!=. replace inc2=0 if inc2!=1 & incometoneeds!=. gen inc3=. replace inc3=1 if incometoneeds <=3 & incometoneeds > 2 & incometoneeds!=. replace inc3=0 if inc3!=1 & incometoneeds!=. gen inc4=. replace inc4=1 if incometoneeds <=4 & incometoneeds > 3 & incometoneeds!=. replace inc4=0 if inc4!=1 & incometoneeds!=. gen inc5=. replace inc5=1 if incometoneeds > 4 & incometoneeds!=. replace inc5=0 if inc5!=1 & incometoneeds!=. tab1 inc1 inc2 inc3 inc4 inc5 *inc1 - 2,271 coded "1"; 16.48% *inc2 - 3,497 coded "1"; 25.38% *inc3 - 2,267 coded "1"; 16.45% *inc4 - 2,293 coded "1"; 16.64% *inc5 - 3,451 coded "1"; 25.05% ********** Producing Descriptive Table **** svyset [pweight=c1cw0] global des male dblack dhisp dwhite momagebirth momed_nohs momed_hs momed_somecol /// momed_bamore inc1 inc2 inc3 inc4 inc5 dmom_employ_unemp num_l18 parentmarried est clear foreach var in $des { svy: mean `var' est store m`var' estadd sd } esttab * using tables/table1_eclsk.csv, replace b(%12.2f) aux(sd) nostar wide compress