Household Income - Appendix 5

National Longitudinal Survey of Youth - 1997 Cohort

Household Income - Appendix 5

Variables Created

  • CV_INCOME_FAMILY
  • CV_HH_POV_RATIO

This program creates the total family income variables. The total family income variable (coded as groshhIY in the programming code) includes total annual cash receipts before taxes from all sources. The program then creates a ratio comparing the family's total income to federal poverty thresholds based on the number of household residents and the number of members under age 18. (For rounds 1-7 the questionnaire asked for income of all household members rather than all family members living in the household. Therefore the total income variable, INCOME_GROSS_YR, reflects total household income.)

Researchers should note that, like many income and asset variables in the data set, these two variables are topcoded to protect respondent privacy. More information about topcoding is available in the Income, Assets & Program Participation section.

Variables Used

/**Variable Names in the Program           Variable Names on the Gator**/
YI_1400                                    YINC-1400
YI_1600                                    YINC-1600
YI_1700                                    YINC-1700
YI_1800                                    YINC-1800
YI_2000                                    YINC-2000
YI_2100                                    YINC-2100
YI_2200                                    YINC-2200
YI_2250                                    YINC-2250
YI_2260                                    YINC-2260
YI_2270                                    YINC-2270
YI_2350                                    YINC-2350
YI_2400                                    YINC-2400
YI_2500                                    YINC-2500
YI_2600                                    YINC-2600
YI_2700                                    YINC-2700
YI_2900                                    YINC-2900
YI_3000                                    YINC-3000
YI_3100                                    YINC-3100
YI_3150                                    YINC-3150
YI_3160                                    YINC-3160
YI_3300                                    YINC-3300
YI_3900                                    YINC-3900
YI_4000                                    YINC-4000
YI_4100                                    YINC-4100
YI_4200                                    YINC-4200
YI_4300                                    YINC-4300
YI_4400                                    YINC-4400
YI_4500                                    YINC-4500
YI_4600                                    YINC-4600
YI_4700                                    YINC-4700
YI_4800                                    YINC-4800
YI_4900                                    YINC-4900
YI_5000                                    YINC-5000
YI_5100                                    YINC-5100
YI_5200                                    YINC-5200
YI_5300                                    YINC-5300
YI_5400                                    YINC-5400
YI_5700A                                   YINC-5700A
YI_5900A                                   YINC-5900A
YI_7600                                    YINC-7600
YI_7700                                    YINC-7700
YI_7800                                    YINC-7800
YI_9200                                    YINC-9200
YI_9300                                    YINC-9300
YI_9400                                    YINC-9400
YI_9600                                    YINC-9600
YI_9700                                    YINC-9700
YI_9800                                    YINC-9800
YI_9900                                    YINC-9900
YI_10100                                   YINC-10100
YI_10200                                   YINC-10200
YI_10300                                   YINC-10300
YI_10400                                   YINC-10400
YI_11600B                                  YINC-11600B
YI_11700                                   YINC-11700
pubid                                      pubid

SAS Code for Variable Creation

******************************************;
***********income from non-farm employment, nfarmY*****************;
*******************************************************************;

nfarmY=-4; /*assign a default value to nfarmY*/

if YI_1400=1 or ((YI_1400 in (-1,-2,-3)) and (YI_1600 eq 1)) then do;
                           /*  flag_nfarmY=1; */      
    
    if YI_1700 >= 0 then nfarmY=YI_1700;

     if YI_1700 in (-1,-2,-3) then do; /*R does not give the exact number.*/
    
        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; /*assign a default value to farmY */

if YI_2000=1 then do;  

                          
     
      if YI_2100 >= 0 then farmY=YI_2100;/*get the amount of farm income */    
      if YI_2100 in (-1,-2,-3) then do;/*R don't give the exact number */  
    
      if YI_2200=1 then    farmY=-2;/*begin to estimate the farm income */  
      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>=0 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;
  /* flag_nfarmP=1;*/
   
   if YI_2600>=0 then nfarmP=YI_2600;
   if YI_2600 in (-1,-2,-3) then do;
  /* if 1<=YI_2700<=7 then flag_nfarmP=2;*/
      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;
else if YI_2350=-2 or YI_2400=-2 or YI_2500=-2 or YI_2700=-2 then nfarmP=-2;
else 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>=0 then farmP=YI_3000;
    if YI_3000 in (-1,-2,-3) then do;
    /*  if  1<=YI_5100=1<=7 then flag_rntinc=2;*/
      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;

***********************************************************************************;
*************** 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=1250;   
      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;

/*Hand-edits  previous note problem1(369)  &  problem2 (65 )   R14*/

problem1=0;
problem2=0;
if YI_2350 in (0, -1 -2) & (problem1a=1 | problem1b=1) then do;
nfarmP=-3;   /* 4-16-10    Rosella:  only code 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=-1 or YI_3900=-1 or YI_4000=-3 or YI_4200=-3 then chsup=-3;

/************************this is 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;

********************************************************************************;
** Dividends from stocks & mutual funds received by the respondent *************;
** and his/her partner/spouse - dividend  ****************************************;
********************************************************************************;*/
dvdend=-4;
if YI_4600=1 then do;

   
   if YI_4700>=0 then dvdend=YI_4700;
    if YI_4700 in (-1,-2,-3) then do;

      if YI_4800=1 then        dvdend=250;      
      else if YI_4800=2 then dvdend=750;                               
      else if YI_4800=3 then dvdend=1750;                               
      else if YI_4800=4 then dvdend=3750;                               
      else if YI_4800=5 then dvdend=6250;                               
      else if YI_4800=6 then dvdend=8750;                               
      else if YI_4800=7 then dvdend=10001;          
   end;
   
end;

if YI_4600=-1 or YI_4800=-1 then dvdend=-1;
else if YI_4600=-2 or YI_4800=-2 then dvdend=-2;
else if YI_4600=-3 or YI_4800=-3 then dvdend=-3;

************************************************************************************;
*** 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. *************************;

********************************************************************************;
*** Property or money from estates, trusts, annuities or inheritances received *;
* by the respondent and his/her partner/spouse - astinc                  *******;
********************************************************************************; */

astinc=-4;
if YI_5200=1 then do;
 
   if YI_5300>=0 then astinc=YI_5300;
      if YI_5300 in (-1,-2,-3) then do;
       if YI_5400=1 then astinc=2500;
      else if YI_5400=2 then astinc=7500;
      else if YI_5400=3 then astinc=17500;
      else if YI_5400=4 then astinc=37500;
      else if YI_5400=5 then astinc=75000;
      else if YI_5400=6 then astinc=175000;
      else if YI_5400=7 then astinc=250001;
   end;
end;

if YI_5200=-1 or YI_5400=-1 then astinc=-1;
else if YI_5200=-2 or YI_5400=-2 then astinc=-2;
else if YI_5200=-3 or YI_5400=-3 then astinc=-3;

************ this is the end of estate,trusts,annuities or inheritances. *********;

/****************************************************************
***  income as gift from friends or family:   gftinc         ***
****************************************************************/

gftinc=-4;

if YI_5700A=1 then do;
    /*flag_gftinc=2;*/
    if YI_5900A=1 then gftinc=250;
    if YI_5900A=2 then gftinc=750;
    if YI_5900A=3 then gftinc=1750;
    if YI_5900A=4 then gftinc=3750;
    if YI_5900A=5 then gftinc=6250;
    if YI_5900A=6 then gftinc=8750;    
    if YI_5900A=7 then gftinc=10001;
end;
if YI_5700A=-1 or YI_5900A=-1 then gftinc=-1;
if YI_5700A=-2 or YI_5900A=-2 then gftinc=-2;
if YI_5700A=-3 or YI_5900A=-3 then gftinc=-3;

********************* this is the end of gift 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;
if YI_7600=1 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_7600=-1 or YI_7800=-1 then othinc=-1;
else if YI_7600=-2 or YI_7800=-2 then othinc=-2;
else if YI_7600=-3 or YI_7800=-3 then othinc=-3;

/**********************************************************************/
/****  Income from other family members living with R: othfaminc    ***/
/**********************************************************************/
/* R12 Change from YI_11600A to YI_11600B */
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;

/************************************************************************/
/*** CASH ASSISTANCE FROM GOVERNMENT PROGRAMS SUCH AS SSI TANF, ETC  ***/
/***********************************************************************/       
/* New in R14 */

Govpro_1=-4;
if YI_6000A=1 then do;
 
    if YI_6100A=1 then Govpro_1=250;
    if YI_6100A=2 then Govpro_1=750;
    if YI_6100A=3 then Govpro_1=1750;
    if YI_6100A=4 then Govpro_1=3750;
    if YI_6100A=5 then Govpro_1=6250;
    if YI_6100A=6 then Govpro_1=8750;    
    if YI_6100A=7 then Govpro_1=10001;
end;

if YI_6000A=-1 or YI_6100A=-1 then Govpro_1=-1;
if YI_6000A=-2 or YI_6100A=-2 then Govpro_1=-2;
if YI_6000A=-3 or YI_6100A=-3 then Govpro_1=-3;

/************************************************************************/
/* AMOUNT OF CASH ASSISTANCE FROM WIC, SNA, OR FOOD STAMPS             */
/***********************************************************************/
/* New in R14 */

Govpro_2=-4;
if YI_6200A=1 then do;
 
    if YI_6300A=1 then Govpro_2=250;
    if YI_6300A=2 then Govpro_2=750;
    if YI_6300A=3 then Govpro_2=1750;
    if YI_6300A=4 then Govpro_2=3750;
    if YI_6300A=5 then Govpro_2=6250;
    if YI_6300A=6 then Govpro_2=8750;    
    if YI_6300A=7 then Govpro_2=10001;
end;

if YI_6200A=-1 or YI_6300A=-1 then Govpro_2=-1;
if YI_6200A=-2 or YI_6300A=-2 then Govpro_2=-2;
if YI_6200A=-3 or YI_6300A=-3 then Govpro_2=-3;

/***************************************************************************/
/* ANY OTHER BENEFITS FROM GOVERNMENT PROGRAMS?*****************************/
/************************************************************************** */                     

Govpro_3=-4;
if YI_6400A=1 then do;
 
    if YI_6500A=1 then Govpro_3=250;
    if YI_6500A=2 then Govpro_3=750;
    if YI_6500A=3 then Govpro_3=1750;
    if YI_6500A=4 then Govpro_3=3750;
    if YI_6500A=5 then Govpro_3=6250;
    if YI_6500A=6 then Govpro_3=8750;    
    if YI_6500A=7 then Govpro_3=10001;
end;

if YI_6400A=-1 or YI_6500A=-1 then Govpro_3=-1;
if YI_6400A=-2 or YI_6500A=-2 then Govpro_3=-2;
if YI_6400A=-3 or YI_6500A=-3 then Govpro_3=-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       dvdend        rntinc           astinc       gftinc        othinc   othfaminc   
                Govpro_1     Govpro_2      Govpro_3         UI_AMT       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 13.                             ***;
***************************************************************;
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 ***;
*** http://www.census.gov/hhes/www/poverty/data/threshld/thresh09.html ***

Poverty Thresholds 2009

Poverty Thresholds for 2009 by Size of Family and Number of Related Children Under 18 Years      
                      

Size of Family Unit Related children under 18 years
None 1 2 3 4 5 6 7 8
One person (unrelated individual) ......                  
    Under 65 years ...... 11,161                
    65 years and over ...... 10,289                
Two people ......                  
    Householder under 65 years ...... 14,366 14,787              
    Householder 65 years and over ...... 12,968 14,731              
Three people ...... 16,781 17,268 17,285            
Four people ...... 22,128 22,490 21,756 21,832          
Five people ...... 26,686 27,074 26,245 25,603 25,211        
Six people ...... 30,693 30,815 30,180 29,571 28,666 28,130      
Seven people ...... 35,316 35,537 34,777 34,247 33,260 32,108 30,845    
Eight people ...... 39,498 39,847 39,130 38,501 37,610 36,478 35,300 35,000  
Nine people or more ...... 47,514 47,744 47,109 46,576 45,701 44,497 43,408 43,138 41,476

*****************************************************************************************************************************************************************************************;*/
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;  /* no obs in round 13*/
 

if hhsize=1 then do;
   if under18=0 then povert=11161;
   else if under18=1 then povert=11161;
end;

else if hhsize=2 then do;
   if under18=0 then povert=14366 ;
   else if under18=1 then povert=14787;
   else if under18=2 then povert=14787;
end;

else if hhsize=3 then do;
   if under18=0 then      povert=16781 ;
   else if under18=1 then povert=17268 ;
   else if under18=2 then povert=17285;
   else if under18=3 then povert=17285 ;
end;

else if hhsize=4 then do;
   if under18=0      then povert=22128 ;
   else if under18=1 then povert=22490;
   else if under18=2 then povert=21756 ;
   else if under18=3 then povert=21832 ;
   else if under18=4 then povert=21832 ;
end;

else if hhsize=5 then do;
   if under18=0      then povert=26686 ;
   else if under18=1 then povert=27074 ;
   else if under18=2 then povert=26245 ;
   else if under18=3 then povert=25603 ;
   else if under18=4 then povert=25211 ;      
   else if under18=5 then povert=25211 ;
end;

else if hhsize=6 then do;  
   if under18=0      then povert=30693 ;
   else if under18=1 then povert=30815 ;
   else if under18=2 then povert=30180 ;
   else if under18=3 then povert=29571;
   else if under18=4 then povert=28666;
   else if under18=5 then povert=28130 ;
   else if under18=6 then povert=28130 ;
end;

else if hhsize=7 then do;  
   if under18=0      then povert=35316;
   else if under18=1 then povert=35537;
   else if under18=2 then povert=34777;
   else if under18=3 then povert=34247;
   else if under18=4 then povert=33260;
   else if under18=5 then povert=32108;
   else if under18=6 then povert=30845;
   else if under18=7 then povert=30845;
end;

else if hhsize=8 then do;        
   if under18=0 then      povert=39498;
   else if under18=1 then povert=39847;
   else if under18=2 then povert=39130;
   else if under18=3 then povert=38501;
   else if under18=4 then povert=37610;
   else if under18=5 then povert=36478;
   else if under18=6 then povert=35300;
   else if under18=7 then povert=35000;
   else if under18=8 then povert=35000;
end;

else if hhsize>=9 then do;     
   if under18=0  then      povert=47514;
   else if under18=1  then povert=47744;
   else if under18=2  then povert=47109;
   else if under18=3  then povert=46576;
   else if under18=4  then povert=45701;
   else if under18=5  then povert=44497;
   else if under18=6  then povert=43408;
   else if under18=7  then povert=43138;
   else if under18=8  then povert=41476;
   else if under18>=9 then povert=41476;
end;

      
/****** this is the end of hoursehold. ******;

*******************************************************************************;
*** 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);

/***  Code povthr as an invalid skip for those with invalid income or household size.; */
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;

/**** Code povthr as a valid skip for those without any gross income (-4 and not 0).;*/
if groshhIY=-4 then do;
   povthr=-4;
   vskpPOV=1;
end;

/**** Code povthr as -5 for all those repondents who were not interviewed in round 14.;*/
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;
endsas;