******************************************************************************** ******************************************************************************** * * Purpose: Adding a Health Insurance Unit (HIU) ID variable to the American * Community Survey (ACS) using IPUMS-USA data * * Last update: April, 2021 * * Notes: This code is only helpful for modifications to SHADAC's HIU. For * all other cases, we strongly recommend generating a dataset from * IPUMS-USA which already includes this variable * ******************************************************************************** ******************************************************************************** /******************************************************************************* Download extract from IPUMS-USA. Creating a HIU ID requires the following variables: YEAR, SAMPLE (which replaces DATANUM in IPUMS), SERIAL, HHWT, GQ, PERNUM, PERWT (pre-selected by IPUMS) and STATEFIP, MOMLOC, POPLOC, MOMLOC2, POPLOC2, SPLOC, NCHILD, RELATE, AGE, SEX, MARST, INCTOT, HIUFPGBASE, HIUFPGINC, POVERTY In addition, it's possible to download variables from children's parents or adult's spouses directly through IPUMS, just use the ATTACH CHARACTERISTICS under OPTIONS after selecting DATA EXTRACT. All variable with an extensions (i.e., _sp, _mom, _pop, _mom2, and _pop2) have been pulled using this feature. *******************************************************************************/ ************************************************************ ** Open dataset ************************************************************ * The following code assumes the user has first set up a working directory for * all input and output files. The most used command to set up a folder is "cd" * For more details, see: https://www.stata.com/manuals/dcd.pdf use "IPUMS, ACS data set.dta", clear ************************************************************ ** Flag persons eligible to be linked to HIU as a child ************************************************************ /* If age <='childage' & not married (or spouse outside of HH) & no own children in household (HH), set as eligible child */ gen echild=(age<=18 & marst!=1 & marst!=3 & sploc==0 & nchild==0) lab var echild "Eligible to be linked to HIU as Child" lab def yesno 0 "No" 1 "Yes", modify lab val echild yesno ************************************************************ ** Create HIU person types ************************************************************ /* Identify eligible children related to HH reference person */ gen rel_echild= (echild==1 & (related>=301 & related<=1001) ) lab var rel_echild "Related Eligible Child" /* Identify highest earner among married couples. When both persons make the same amounts, choose the first in the roster */ gen highearn=0 if marst<4 & marst==marst_sp & sploc>0 replace highearn=1 if marst<4 & marst==marst_sp & sploc>0 & inctot>inctot_sp replace highearn=1 if marst<4 & marst==marst_sp & sploc>0 & inctot==inctot_sp & pernum 0 & momloc>0 & inctot_pop>inctot_mom & age<19 replace pwe=poploc if poploc> 0 & poploc2>0 & inctot_pop>inctot_pop2 & age<19 replace pwe=poploc2 if poploc> 0 & poploc2>0 & inctot_pop2>inctot_pop & age<19 replace pwe=momloc if poploc> 0 & momloc>0 & inctot_mom>inctot_pop & age<19 replace pwe=momloc if momloc> 0 & momloc2>0 & inctot_mom>inctot_mom2 & age<19 replace pwe=momloc2 if momloc> 0 & momloc2>0 & inctot_mom2>inctot_mom & age<19 replace pwe=poploc if poploc> 0 & momloc>0 & inctot_pop==inctot_mom & poploc 0 & poploc2>0 & inctot_pop==inctot_pop2 & poploc 0 & poploc2>0 & inctot_pop2==inctot_pop & poploc2 0 & momloc>0 & inctot_mom==inctot_pop & momloc 0 & momloc2>0 & inctot_mom==inctot_mom2 & momloc 0 & momloc2>0 & inctot_mom2==inctot_mom & momloc20 & highearn!=0) replace hiup=2 if highearn==0 replace hiup=3 if echild==1 & (poploc!=0 | momloc!=0) replace hiup=4 if marst!=1 & echild==0 & nchild==0 replace hiup=5 if echild==1 & hiup==. & rel_echild==1 replace hiup=6 if echild==1 & hiup==. & rel_echild==0 lab var hiup "HIU Person Type" lab def hiup 1 "HIU Ref" 2 "Dependent Spouse" 3 "Eligible Child" /// 4 "Single Adult" 5 "Related Singelton Child" /// 6 "Unrelated Singleton Child", modify lab val hiup hiup tab hiup, m ************************************************************ ** Create a pointer for related children without parents ************************************************************ /*Flag HIU Referents*/ gen hiu_ref=(hiup==1) lab var hiu_ref "HIU Reference Person" /*Flag households with HIU referents*/ egen hiu_refhhld=max(hiu_ref), by(serial) lab var hiu_refhhld "HIUP==1 Present in HH" /*Flag first HIU referent person in household with their person number, if one exists*/ egen first_hiuref=min(pernum) if hiup==1, by(serial) /*Apply first HIU ref person number to everyone in household, if one exists*/ egen first_point=min(first_hiuref), by(serial) /*Point to first record in HH if no HIU Referent in Household*/ replace first_point=1 if first_point==. lab var first_point "Point to First HIU REF of HH" ************************************************************ ** Generate the HIU pointer ************************************************************ /*Initate rule flag to indicate where HIU pointer originates*/ gen hiu_point_rule=. /*Create Pointers and Flag Source*/ /* HIU_POINT_RULE=1: Point referent to self HIU_POINT_RULE=2: Point married dependent to their spousal referent (by sploc) Point married dependent (but with no spouse listed) to themselves (by definition this should yield no case) HIU_POINT_RULE=3: Point child to highest earning parent (or first in roster) when both present HIU_POINT_RULE=4: Point child to single parent if the other is absent HIU_POINT_RULE=5: Point single adult to self HIU_POINT_RULE=6: Point related singleton child to HIU ref HIU_POINT_RULE=7: Point unrelated children to self */ gen hiu_point=pernum if hiup==1 replace hiu_point_rule=1 if hiu_point !=. replace hiu_point=sploc if hiup==2 & sploc>0 replace hiu_point_rule=2 if hiu_point !=. & hiu_point_rule==. replace hiu_point=pwe if hiup==3 & hiu_point==. replace hiu_point_rule=3 if hiu_point !=. & hiu_point_rule==. replace hiu_point=singpar if hiup==3 & hiu_point==. replace hiu_point_rule=4 if hiu_point !=. & hiu_point_rule==. replace hiu_point=pernum if hiup==4 replace hiu_point_rule=5 if hiu_point !=. & hiu_point_rule==. replace hiu_point=first_point if hiup==5 replace hiu_point_rule=6 if hiu_point !=. & hiu_point_rule==. replace hiu_point=pernum if hiup==6 replace hiu_point_rule=7 if hiu_point !=. & hiu_point_rule==. lab var hiu_point "HIU Ref Pointer" lab var hiu_point_rule "HIU Pointer Rule" lab def hiu_point_rule 1 "Referent" 2 "Married Dependent to Spouse Ref" 3 "Child to PWE parent" /// 4 "Child to Single Parent" 5 "Single Adult" /// 6 "Point to Ref: Related Single Child" 7 "Single Child", modify lab val hiu_point_rule hiu_point_rule ************************************************************ ** Create HIU ID ************************************************************ tostring (serial), gen(hh_id) format(%07.0f) tostring (hiu_point), gen(hiu_point_s) format(%02.0f) *Concatenate HH_ID POINTS to form HIU ID* gen hiu_id=hh_id+hiu_point_s lab var hiu_id "HIU ID" ************************************************************ ** Special cases ************************************************************ * Every year some cases may escape the criteria used to create the HIU. In this * section, SHDAC will list these cases for specific years and recommend how to * recode these /* No special cases in 2019*/ ************************************************************ ** Create poverty variables ************************************************************ *Family Size gen one=1 egen hiusize=sum(one), by(hiu_id) label var hiusize "Updated HIU size" *Adjusted Personal Income * 2019: 1.010145 gen inctotadj=inctot*1.010145 label var inctotadj "Adjusted Family Income" * Adjust for non-universe observations gen inctot_adj=inctotadj replace inctot_adj=0 if inctot==9999999 * Aggregate income by HIU egen hiuinctot=sum(inctot_adj), by(hiu_id) label var hiuinctot "HIU Aggregated Income" *Generate the HIU Poverty Universe gen hiu_povuniv=1 replace hiu_povuniv=0 if gq==3 replace hiu_povuniv=0 if gq==4 & poverty==. replace hiu_povuniv=0 if agep<15 & hiusize==1 label var hiu_povuniv "Person in the HIU Poverty Universe" *HHS Poverty Guidelines gen hiu_hhspov_guide=. replace hiu_hhspov_guide=(fpg_base+fpg_increment*(hiusize-1)) *Ratio of family income to HHS Poverty Guideline gen hhspov_hiu=. replace hhspov_hiu=(hiuinctot/hhspov_guide_)*100 lab var hhspov_hiu "Ratio of HIU Income to HHS Poverty Guidelines" *Create income variables for ad-hoc poverty categories gen fpg4=. replace fpg4=1 if hhspov_hiu<=138.00 replace fpg4=2 if hhspov_hiu>138.00 & hhspov_hiu<=250.00 replace fpg4=3 if hhspov_hiu>250.00 & hhspov_hiu<=400.00 replace fpg4=4 if hhspov_hiu>400.00 & hhspov_hiu!=. lab var fpg4 "Income Categories, HIU" lab def fpg4 1 "0-138" 2 "139-250" 3 "251-400" 4 "401+" , modify lab val fpg4 fpg4 ************************************************************ ** Save file with HIU variable ************************************************************ save "ACS, HIU data set.dta", replace ******************************************************************************** ********* END HIU ************************************************************** ********************************************************************************