/****************************HOUSEHOLD INCOME************************************/ /** **/ /** **/ /** VARIABLES IN GATOR VARIABLES IN THIS PROGRAM **/ /** ----------------- ---------------------------- **/ /** CV_INCOME_FAMILY TOP_GROSHHIY **/ /** CV_HH_POV_RATIO TOP_POVTHR **/ /** **/ /** This program creates two variables, top_grohhIY and top_povthr. Both are **/ /** top-coded by the means of top 2%. The rule for top-coding is: **/ /** 1. The variable is above top 2%; **/ /** 2. The other variable is top-coded, which means as long as one is **/ /** top-coded, the other one must be top-coded. **/ /** **/ /********************************************************************************/ /******************************************************************************** QNAME VARIABLE NAME YINC-10400 YI_10400 YINC-11300B YI_11300B YINC-11600B YI_11600B YINC-11700 YI_11700 YINC-1400 YI_1400 YINC-1600 YI_1600 YINC-1700 YI_1700 YINC-1800 YI_1800 YINC-2000 YI_2000 YINC-2100 YI_2100 YINC-2200 YI_2200 YINC-2250 YI_2250 YINC-2260 YI_2260 YINC-2270 YI_2270 YINC-2350 YI_2350 YINC-2400 YI_2400 YINC-2500 YI_2500 YINC-2600 YI_2600 YINC-2700 YI_2700 YINC-2900 YI_2900 YINC-3000 YI_3000 YINC-3100 YI_3100 YINC-3150 YI_3150 YINC-3160 YI_3160 YINC-3300 YI_3300 YINC-3900 YI_3900 YINC-4000 YI_4000 YINC-4100 YI_4100 YINC-4200 YI_4200 YINC-4300 YI_4300 YINC-4400 YI_4400 YINC-4500 YI_4500 YINC-4600 YI_4600 YINC-4700 YI_4700 YINC-4800 YI_4800 YINC-4900 YI_4900 YINC-5000 YI_5000 YINC-5100 YI_5100 YINC-5200 YI_5200 YINC-5300 YI_5300 YINC-5400 YI_5400 YINC-5700A YI_5700A YINC-5900A YI_5900A YINC-6000A YI_6000A YINC-6100A YI_6100A YINC-6200A YI_6200A YINC-6300A YI_6300A YINC-6400A YI_6400A YINC-6500A YI_6500A YINC-7600 YI_7600 YINC-7700 YI_7700 YINC-7800 YI_7800 CVC_AMT_UI_YR.20 UI_AMT_20 CV_HH_SIZE hhsize CV_HH_UNDER_18 under18; ************************************************** First: determine marital status array mars (l) mars208-mars514; array cohh (l) cohh208-cohh514; array link (l) link208-link514; count0=0; count1=0; count1a=0; count2=0; count3=0; count4=0; count3N=0; count6=0; countc=0; countlink=0; problem1a=0; problem1b=0; problem2a=0; problem2b=0; do l=274 to 285; if mars = 0 then count0=count0+1; /* not cohabiting and not marrird */ if mars = 1 then count1a=count1a+1; /* cohabiting */ if mars = 2 then count2=count2 +1; /* married */ if mars in (1,2) then count1=count1+1; /* cohabiting or marrird */ if mars in (3,4) then count3=count3+1; /* Divorced or separated */ if mars =4 then count4=count4+1; /* Divorced only */ if mars in (-3) then count3N=count3N+1; /* Do not know */ if link>0 then countlink=countlink+1; /* partner link */ end; /*Cohabiting or married at least one month */ if count1>0 then problem1a=1; /*Divorced or separated but cohabiting with someone else at least two month*/ if count3=12 & countlink>1 & problem1a=0 then problem1b=1; /* countlink>1 more then one month lives partner */ /*Cohabiting or married less than 6 month */ if 00 & count2=0 then countc=1; data income.mar2020; set one; keep pubid countlink problem1a problem1b problem2a problem2b mars481-mars492 cohh481-cohh492 link481-link492; ********************************************************************************/ SAS Code for Variable Creation /******************************************; ***********income from non-farm employment, nfarmY*****************; *******************************************************************;*/ nfarmY=-4; if YI_1400=1 or ((YI_1400 in (-1,-2,-3)) and (YI_1600 eq 1)) then do; if YI_1700 >= 0 then nfarmY=YI_1700; else if YI_1700 in (-1,-2,-3) then do; if YI_1800 eq 1 then nfarmY=2500; else if YI_1800 = 2 then nfarmY=7500; else if YI_1800 = 3 then nfarmY=17500; else if YI_1800 = 4 then nfarmY=37500; else if YI_1800 = 5 then nfarmY=75000; else if YI_1800 = 6 then nfarmY=175000; else if YI_1800 = 7 then nfarmY=250001; end; end; if YI_1600=-1 or YI_1800=-1 then nfarmY=-1; /*R refuse to answer */ else if YI_1600=-2 or YI_1800=-2 then nfarmY=-2; /*R don't know */ else if YI_1600=-3 or YI_1800=-3 then nfarmY=-3; /*R invalid skip */ /*******************This is the end of non-farm income********************; **************************************************************************; *** Income from farm and self-employment of respondent - (farmY)**********; **************************************************************************;*/ farmY=-4; if YI_2000=1 then do; if YI_2100 not in(-1, -2, -3) then farmY=YI_2100; else if YI_2100 in (-1,-2,-3) then do; if YI_2200=1 then farmY=-2; else if YI_2200=2 then farmY=2500; else if YI_2200=3 then farmY=7500; else if YI_2200=4 then farmY=17500; else if YI_2200=5 then farmY=37500; else if YI_2200=6 then farmY=75000; else if YI_2200=7 then farmY=175000; else if YI_2200=8 then farmY=250001; end; end; if YI_2000=-1 or YI_2200=-1 then farmY=-1; else if YI_2000=-2 or YI_2200=-2 then farmY=-2; else if YI_2000=-3 or YI_2200=-3 then farmY=-3; /*******************This is the end of farm income*********************; ***********************************************************************; **********************Worker's Compensation,wcompY*********************; ***********************************************************************; */ wcompY=-4; if YI_2250=1 then do; if YI_2260 not in(-1, -2, -3) then wcompY=YI_2260; if YI_2260 in (-1,-2,-3) then do; if YI_2270=1 then wcompY=500; else if YI_2270=2 then wcompY=1750; else if YI_2270=3 then wcompY=3750; else if YI_2270=4 then wcompY=7500; else if YI_2270=5 then wcompY=17500; else if YI_2270=6 then wcompY=37500; else if YI_2270=7 then wcompY=50001; end; end; if YI_2250=-1 or YI_2270=-1 then wcompY=-1; /*R refuse to answer. */ else if YI_2250=-2 or YI_2270=-2 then wcompY=-2; /*R don't know. */ else if YI_2250=-3 or YI_2270=-3 then wcompY=-3; /*invalid skip */ /*******************This is the end of worker's compensation********************; ********************************************************************************; *****Income from non-farm employment of respondent's spouse/partner - nfarmP****; ********************************************************************************;*/ nfarmP=-4; if YI_2350=1 & (YI_2400=1 or (YI_2400 in (-1) & YI_2500=1)) then do; if YI_2600>=0 then nfarmP=YI_2600; if YI_2600 in (-1,-2,-3) then do; if YI_2700=1 then nfarmP=2500; else if YI_2700=2 then nfarmP=7500; else if YI_2700=3 then nfarmP=17500; else if YI_2700=4 then nfarmP=37500; else if YI_2700=5 then nfarmP=75000; else if YI_2700=6 then nfarmP=175000; else if YI_2700=7 then nfarmP=250001; end; end; if YI_2350=-1 or YI_2500=-1 or YI_2700=-1 then nfarmP=-1; if YI_2350=-2 or YI_2400=-2 or YI_2500=-2 or YI_2700=-2 then nfarmP=-2; if YI_2350=-3 or YI_2400=-3 or YI_2500=-3 or YI_2700=-3 then nfarmP=-3; /*******************This is the end of non-farm income from partner/spouse*******; *********************************************************************************; ******Income from farm and self-employment of R's spouse/partner - farmP*********; *********************************************************************************; */ farmP=-4; if YI_2350=1 & YI_2900=1 then do; if YI_3000 not in (-1, -2, -3) then farmP=YI_3000; if YI_3000 in (-1,-2,-3) then do; if YI_3100=1 then farmP=-2; else if YI_3100=2 then farmP=2500; else if YI_3100=3 then farmP=7500; else if YI_3100=4 then farmP=17500; else if YI_3100=5 then farmP=37500; else if YI_3100=6 then farmP=75000; else if YI_3100=7 then farmP=175000; else if YI_3100=8 then farmP=250001; end; end; if YI_2350=-1 or YI_2900=-1 or YI_3100=-1 then farmP=-1; else if YI_2350=-2 or YI_2900=-2 or YI_3100=-2 then farmP=-2; else if YI_2350=-3 or YI_2900=-3 or YI_3100=-3 then farmP=-3; /*******************This is the end of farm income of R's partner/spouse***********; ***********************************************************************************; *************** worker's compensation from R's partner/spouse - wcompP*************; ***********************************************************************************; */ wcompP=-4; if YI_2350=1 & YI_3150=1 then do; if YI_3160>=0 then wcompP=YI_3160; if YI_3160 in (-1,-2,-3) then do; if YI_3170=1 then wcompP=500; else if YI_3170=2 then wcompP=1750; else if YI_3170=3 then wcompP=3750; else if YI_3170=4 then wcompP=7500; else if YI_3170=5 then wcompP=17500; else if YI_3170=6 then wcompP=37500; else if YI_3170=7 then wcompP=50001; end; end; if YI_2350=-1 or YI_3150=-1 or YI_3170=-1 then wcompP=-1; else if YI_2350=-1 or YI_3150=-2 or YI_3170=-2 then wcompP=-2; else if YI_2350=-1 or YI_3150=-3 or YI_3170=-3 then wcompP=-3; problem1=0; problem2=0; if YI_2350 in (0, -1, -2) & (problem1a=1 | problem1b=1) then do; nfarmP=-3; problem1=1; end; if YI_2350 in( 1,-1,-2) & (problem2a=1 | problem2b=1) then do; wcompP=-4; farmP=-4; nfarmP=-4; problem2=1; end; /**************************************************************************************; *** Child support payment received by respondent or his/her partner/spouse - chsup****; **************************************************************************************;*/ chsup=-4; if YI_3300=1 & YI_3900=1 then do; if YI_4000=1 & YI_4100>=0 then chsup=YI_4100; if YI_4000=1 & YI_4100 in (-1,-2,-3) then do; if YI_4200=1 then chsup=500; else if YI_4200=2 then chsup=1750; else if YI_4200=3 then chsup=3750; else if YI_4200=4 then chsup=7500; else if YI_4200=5 then chsup=17500; else if YI_4200=6 then chsup=37500; else if YI_4200=7 then chsup=50001; end; end; if YI_3300=-1 or YI_3900=-1 or YI_4000=-1 or YI_4200=-1 then chsup=-1; else if YI_3300=-2 or YI_3900=-2 or YI_4000=-2 or YI_4200=-2 then chsup=-2; else if YI_3300=-3 or YI_3900=-3 or YI_4000=-3 or YI_4200=-3 then chsup=-3; /*******************This is the end of child support************************************; ****************************************************************************************; *** Interest payments received by the respondent and r's partner/spouse - intrst *******; ****************************************************************************************; */ intrst=-4; if YI_4300=1 then do; if YI_4400>=0 then intrst=YI_4400; if YI_4400 in (-1,-2,-3) then do; if YI_4500=1 then intrst=250; else if YI_4500=2 then intrst=750; else if YI_4500=3 then intrst=1750; else if YI_4500=4 then intrst=3750; else if YI_4500=5 then intrst=6250; else if YI_4500=6 then intrst=8750; else if YI_4500=7 then intrst=10001; end; end; if YI_4300=-1 or YI_4500=-1 then intrst=-1; else if YI_4300=-2 or YI_4500=-2 then intrst=-2; else if YI_4300=-3 or YI_4500=-3 then intrst=-3; /*******************This is the end of interest*************************************; ************************************************************************************; *** Rental income received by the respondent and his/her partner/spouse - rntinc ***; ************************************************************************************;*/ rntinc=-4; if YI_4900=1 then do; if YI_5000>=0 then rntinc=YI_5000; if YI_5000 in (-1,-2,-3) then do; if YI_5100=1 then rntinc=500; else if YI_5100=2 then rntinc=1750; else if YI_5100=3 then rntinc=3750; else if YI_5100=4 then rntinc=7500; else if YI_5100=5 then rntinc=17500; else if YI_5100=6 then rntinc=37500; else if YI_5100=7 then rntinc=50001; end; end; if YI_4900=-1 or YI_5100=-1 then rntinc=-1; else if YI_4900=-2 or YI_5100=-2 then rntinc=-2; else if YI_4900=-3 or YI_5100=-3 then rntinc=-3; /*******************This is the end of rental income*******************************; ***********************************************************************************; *** Income from other sources: ss payments, pension and retirement income, ****; *** alimony, payments from insurance policies, etc. received by the respondent ****; *** and his/her partner/spouse - othinc. ****; ***********************************************************************************;*/ othinc=-4;*R19: YI_7600 was divided into YI7601 and YI7602; if YI_7602=1 | YI_7602 in (-1,-2) then do; if YI_7700>=0 then othinc=YI_7700; if YI_7700 in (-1,-2,-3) then do; if YI_7800=1 then othinc=500; else if YI_7800=2 then othinc=1750; else if YI_7800=3 then othinc=3750; else if YI_7800=4 then othinc=7500; else if YI_7800=5 then othinc=17500; else if YI_7800=6 then othinc=37500; else if YI_7800=7 then othinc=50001; end; end; if YI_7800=-1 then othinc=-1; else if YI_7800=-2 then othinc=-2; else if YI_7800=-3 then othinc=-3; /**********************************************************************/ /**** Income from other family members living with R: othfaminc ***/ /**********************************************************************/ othfaminc=-4; if YI_11600B>=0 then do; othfaminc=YI_11600B; end; if YI_11600B in (-1,-2,-3) then do; if YI_11700=1 then othfaminc=2500; else if YI_11700=2 then othfaminc=7500; else if YI_11700=3 then othfaminc=17500; else if YI_11700=4 then othfaminc=37500; else if YI_11700=5 then othfaminc=75000; else if YI_11700=6 then othfaminc=175000; else if YI_11700=7 then othfaminc=250001; end; if YI_11700=-1 then othfaminc=-1; else if YI_11700=-2 then othfaminc=-2; else if YI_11700=-3 then othfaminc=-3; /*************************************************************************************; *** Compute the respondent's gross household income in the past year (groshhIY). ***; ************************************************************************************/ if UI_spouse=0 then UI_spouse =-4; array varsY (*) nfarmY farmY wcompY nfarmP farmP wcompP chsup intrst rntinc othinc othfaminc UI_AMT_20 UI_spouse; groshhIY=0; do i=1 to dim(varsY); if varsY(i) not in (-1,-2,-3,-4, .) then groshhIY=groshhIY+varsY(i); end; groshhIY=round(groshhIY,1); /***********************************************************************; *** Code groshhIY as an invalid skip if there are invalid responses.***; ************************************************************************;*/ do i=1 to dim(varsY); if varsY(i)=-1 then do; groshhIY=-1; invskpGIY=1; end; else if varsY(i)=-2 then do; groshhIY=-2; invskpGIY=2; end; else if varsY(i)=-3 then do; groshhIY=-3; invskpGIY=3; end; end; /****************************************************************; *** Code groshhIY as -5 for all those respondents who were ***; *** not interviewed in Round 20. ***; *****************************************************************;*/ if YI_1400=-5 then do; groshhIY=-5; nonintGIY=1; end; /****************************************************************; *** THIS IS THE END OF INCOME ***; *****************************************************************;*/ **********************************************************************************; **********************************************************************************; ************ start of the income-poverty ratio section (povthr) ******************; **********************************************************************************; /*** Create the poverty thresholds taken from u.s.census' website ***; *** https://www.census.gov/data/tables/time-series/demo/income-poverty/historical-poverty-thresholds.html *** Poverty Thresholds 2020 Poverty Thresholds for 2020 by Size of Family and Number of Related Children Under 18 Years Size of Family Unit Related children under 18 years None One Two Three Four Five Six Seven Eight+ One person (unrelated individual) Under 65 years 13,465 65 years and over 12,413 Two people....................... Householder under 65 years 17,331 17,839 Householder 65 years and over 15,644 17,771 Three people 20,244 20,832 20,852 Four people 26,695 27,131 26,246 26,338 Five people 32,193 32,661 31,661 30,887 30,414 Six people 37,027 37,174 36,408 35,674 34,582 33,935 Seven people 42,605 42,871 41,954 41,314 40,124 38,734 37,210 Eight people 47,650 48,071 47,205 46,447 45,371 44,006 42,585 42,224 Nine people or more 57,319 57,597 56,831 56,188 55,132 53,679 52,366 52,040 50,035 ***************************************************************************************************************/ povert=-4; if hhsize=-1 or under18=-1 then povert=-1; if hhsize=-2 or under18=-2 then povert=-2; if hhsize=-3 or under18=-3 then povert=-3; /*** Check if there are only children under 18 in the household - check these cases again.;*/ only_under18_HH=0; if hhsize>0 & under18>0 & hhsize=under18 then only_under18_HH=1; if hhsize=1 then do; if under18=0 then povert= 13465; end; else if hhsize=2 then do; if under18=0 then povert= 17331; else if under18=1 then povert= 17839; end; else if hhsize=3 then do; if under18=0 then povert= 20244; else if under18=1 then povert= 20832; else if under18=2 then povert= 20852; end; else if hhsize=4 then do; if under18=0 then povert= 26695; else if under18=1 then povert= 27131; else if under18=2 then povert= 26246; else if under18=3 then povert= 26338; end; else if hhsize=5 then do; if under18=0 then povert= 32193; else if under18=1 then povert= 32661; else if under18=2 then povert= 31661; else if under18=3 then povert= 30887; else if under18=4 then povert= 30414; end; else if hhsize=6 then do; if under18=0 then povert= 37027; else if under18=1 then povert= 37174; else if under18=2 then povert= 36408; else if under18=3 then povert= 35674; else if under18=4 then povert= 34582; else if under18=5 then povert= 33935; end; else if hhsize=7 then do; if under18=0 then povert= 42605; else if under18=1 then povert= 42871; else if under18=2 then povert= 41954; else if under18=3 then povert= 41314; else if under18=4 then povert= 40124; else if under18=5 then povert= 38734; else if under18=6 then povert= 37210; end; else if hhsize=8 then do; if under18=0 then povert= 47650; else if under18=1 then povert= 48071; else if under18=2 then povert= 47205; else if under18=3 then povert= 46447; else if under18=4 then povert= 45371; else if under18=5 then povert= 44006; else if under18=6 then povert= 42585; else if under18=7 then povert= 42224; end; else if hhsize>=9 then do; if under18=0 then povert= 57319; else if under18=1 then povert= 57597; else if under18=2 then povert= 56831; else if under18=3 then povert= 56188; else if under18=4 then povert= 55132; else if under18=5 then povert= 53679; else if under18=6 then povert= 52366; else if under18=7 then povert= 52040; else if under18=8 then povert= 50035; else if under18>=9 then povert= 50035; end; /****** this is the end of household. ******; *******************************************************************************; *** Compute the respondent's gross household income to poverty level ratio. ***; *******************************************************************************; */ povthr=-4; if groshhIY>=0 & povert>0 then povthr=round(((groshhIY*100)/povert),1); if groshhIY=-1 or povert=-1 then do; povthr=-1; invskpPOV=1; end; if groshhIY=-2 or povert=-2 then do; povthr=-2; invskpPOV=2; end; if groshhIY=-3 or povert=-3 then do; povthr=-3; invskpPOV=3; end; if groshhIY=-4 then do; povthr=-4; vskpPOV=1; end; if YI_1400=-5 then do; povthr=-5; nonintPOV=1; end; if groshhIY in (-1,-2) then groshhIY=-3; if povthr in (-1,-2) then povthr=-3; groshhIY_notop=groshhIY; povthr_notop=povthr; /*****************************************************************************; ****** THIS IS THE END OF INCOME-POVERTY RATIO. *****; ******************************************************************************; ********************* top-coding *********************************************; *NOTE: The first step below calculates the 98th percentile for both groshhIY and poverthr(topcode_GIY, topcode_POV). RUN THE PROGRAM TO THIS STEP AND STOP. Plug these threshholds in to get values in the top 2% (over_gross, over_pov). Once the values in the top 2% have been identified, the next step is to find the mean of those values (mean_topcode_GIY, mean_topcode_POV). RUN THE PROGRAM TO THIS STEP AND STOP. The numerical values used to to topcode have to be inserted in the final step where the output will be generated.; *finds 98% for groshhIY and povthr when a reported amount is present, i.e. ge 0 (topcode_GIY, topcode_POV); ******************************************************************************; */ ******************************************************************************; ****** THIS IS THE END OF INCOME-POVERTY RATIO. *****; ******************************************************************************; /****************** Top Coding *************************;*/ proc capability data=one noprint pctldef=3; where nonintGIY=. & invskpGIY=.; var groshhIY; output out=GIY1 pctlpts=98 pctlpre=top_GIY; run; proc capability data=one noprint pctldef=3; where nonintPOV=. & invskpPOV=. & vskpPOV=.; var povthr; output out=POV1 pctlpts=98 pctlpre=top_POV; run; data one; set one; if _n_=1 then set GIY1; run; data one; set one; if _n_=1 then set POV1; run; proc means data=one noprint; where groshhIY>=top_GIY98; var groshhIY; output out=GIY2 mean=mean_top_GIY98; run; proc means data=one noprint; where povthr>=top_POV98; var povthr; output out=POV2 mean=mean_top_POV98; run; data one; set one; if _n_=1 then set GIY2; drop _type_ _freq_; run; data one; set one; if _n_=1 then set POV2; drop _type_ _freq_; run; data one; set one; if groshhIY>=top_GIY98 then do; top_groshhIY=round(mean_top_GIY98,1); topGIY=1; end; else do; top_groshhIY=groshhIY; topGIY=0; end; if povthr>=top_POV98 then do; top_povthr=round(mean_top_POV98,1); topPOV=1; end; else do; top_povthr=povthr; topPOV=0; end; run; data one; set one; chk1=0; chk2=0; if topGIY=1 and topPOV=0 then chk1=1; if topPOV=1 and topGIY=0 then chk2=1; data one; set one; if chk1=1 then do; top_povthr=round(mean_top_POV98,1); topPOV=2; end; if chk2=1 then do; top_groshhIY=round(mean_top_GIY98,1); topGIY=2; end; if topGIY>0 | topPOV>0 then do; groshhIY=top_groshhIY; povthr=top_povthr; end; run; rename groshhIY=CV_INCOME_FAMILY povthr=CV_HH_POV_RATIO;