Over 30 Assets (Collapsed) - Appendix 5

Over 30 Assets (Collapsed) - Appendix 5

Variables Created

  • CVC_HH_NET_WORTH_30 (total net worth)
  • CVC_HOUSE_VALUE_30 (value of owned housing)
  • CVC_HOUSE_DEBT_30 (amount of housing debt)
  • CVC_HOUSE_TYPE_30 (type of housing owned)
  • CVC_ASSETS_FINANCE_30 (value of financial assets)
  • CVC_ASSETS_NONFINANCE_30 (value of non-financial assets, excluding housing)
  • CVC_ASSETS_DEBT_30 (amount of debt, excluding housing)
  • CVC_ASSETS_RND_30 (round in which assets data were collected)

Round 14 initiated the age 30 assets section; the final round where these questions were included was round 18. Like the age 20 and 25 sections, this module is administered in the first interview after the respondent's 30th birthday. These variables report the respondent's assets at age 30. As with the earlier sections, the variables are presented as collapsed variables which contain data from all survey rounds in which the section is administered. (See the description of the age 20 variable program for more information.)

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

Variables Used 

Variables in the programs that generated the 2017 (round 18) assets30 created variables are
listed below.  In general several naming conventions are used:
  --Survey year is deleted from the end of extracted qname
  --Decimals (.) and hyphens (-) in qnames were replaced with underscores (_)
  --Tildas were eliminated from qnames
  --Qnames beginning with "yast" were shortened to "yas"
  --Qnames beginning with "yhhi" were shortened to "hhi"
  --Qnames beginning with "ysch" were converted to "e", and the loop numbers were collapsed to single digits

/**Variable Names in the Program         Variable Names on the Gator**/

  pubid                                      PUBID_2017                                
  yas30_105                                  YAST30-105_2017                           
  yhou_1                                     YHOU-1_2017                               
  yhou_dlimortgage                           YHOU-DLIMORTGAGE_2017                     
  yhou_dliown2                               YHOU-DLIOWN2_2017                         
  yhou_2                                     YHOU-2_2017                               
  yhou_dliowned                              YHOU-DLIOWNED_2017                        
  yhou_8                                     YHOU-8_2017                               
  yhou_9                                     YHOU-9_2017                               
  yhou_10m                                   YHOU-10~M_2017                            
  yhou_10y                                   YHOU-10~Y_2017                            
  yhou_11                                    YHOU-11_2017                              
  yhou_12a                                   YHOU-12A_2017                             
  yhou_12bl                                  YHOU-12B_000001_2017                      
  yhou_12bu                                  YHOU-12B_000002_2017                      
  yhou_12c                                   YHOU-12C_2017                             
  yhou_13                                    YHOU-13_2017                              
  yhou_ch1                                   YHOU-CH1_2017                             
  yhou_ch2                                   YHOU-CH2_2017                             
  yhou_ch_check                              YHOU-CH_CHECK_2017                        
  yhou_ch3                                   YHOU-CH3_2017                             
  yhou_ch3am                                 YHOU-CH3A~M_2017                          
  yhou_ch3ay                                 YHOU-CH3A~Y_2017                          
  yhou_ch4                                   YHOU-CH4_2017                             
  yhou_ch5a                                  YHOU-CH5A_2017                            
  yhou_ch5bl                                 YHOU-CH5B_000001_2017                     
  yhou_ch5bu                                 YHOU-CH5B_000002_2017                     
  yhou_ch5c                                  YHOU-CH5C_2017                            
  yhou_ch6                                   YHOU-CH6_2017                             
  yhou_ch7                                   YHOU-CH7_2017                             
  yhou_ch7a                                  YHOU-CH7A_2017                            
  yhou_ch7bl                                 YHOU-CH7B_000001_2017                     
  yhou_ch7bu                                 YHOU-CH7B_000002_2017                     
  yhou_ch7c                                  YHOU-CH7C_2017                            
  yhou_ch8                                   YHOU-CH8_2017                             
  yhou_ch8_1                                 YHOU-CH8_1_2017                           
  yhou_ch8a                                  YHOU-CH8A_2017                            
  yhou_ch8c                                  YHOU-CH8C_2017                            
  yhou_housevalue                            YHOU-HOUSEVALUE_2017                      
  yhou_chhva                                 YHOU-CHHVA_2017                           
  yhou_chhvbl                                YHOU-CHHVB_000001_2017                    
  yhou_chhvbu                                YHOU-CHHVB_000002_2017                    
  yhou_chhvc                                 YHOU-CHHVC_2017                           
  yas30_200a                                 YAST30-200A_2017                          
  yas30_210a                                 YAST30-210A_2017                          
  yas30_300a                                 YAST30-300A_2017                          
  yas30_500a                                 YAST30-500A_2017                          
  yas30_510a                                 YAST30-510A_2017                          
  yas30_520a                                 YAST30-520A_2017                          
  yas30_age30elig1                           YAST30-AGE30ELIG1_2017                    
  yas30_ch9                                  YAST30-CH9_2017                           
  yas30_ch10                                 YAST30-CH10_2017                          
  yas30_ch10a                                YAST30-CH10A_2017                         
  yas30_age30elig2                           YAST30-AGE30ELIG2_2017                    
  yas30_4000s1                               YAST30-4000S1_2017                        
  yas30_4000s2                               YAST30-4000S2_2017                        
  yas30_4000s3                               YAST30-4000S3_2017                        
  yas30_4000s3a                              YAST30-4000S3A_2017                       
  yas30_4000s4                               YAST30-4000S4_2017                        
  yas30_4000s5                               YAST30-4000S5_2017                        
  yas30_4000s6                               YAST30-4000S6_2017                        
  yas30_4000s8                               YAST30-4000S8_2017                        
  yas30_4000s9                               YAST30-4000S9_2017                        
  yas30_4000s9a                              YAST30-4000S9A_2017                       
  yas30_4000s10                              YAST30-4000S10_2017                       
  yas30_4000s10a                             YAST30-4000S10A_2017                      
  yas30_4400                                 YAST30-4400_2017                          
  yas30_4420                                 YAST30-4420_2017                          
  yas30_4422                                 YAST30-4422_2017                          
  yas30_4424l                                YAST30-4424_000001_2017                   
  yas30_4424u                                YAST30-4424_000002_2017                   
  yas30_4426                                 YAST30-4426_2017                          
  yas30_4530                                 YAST30-4530_2017                          
  yas30_4550                                 YAST30-4550_2017                          
  yas30_4552                                 YAST30-4552_2017                          
  yas30_4660                                 YAST30-4660_2017                          
  yas30_4680                                 YAST30-4680_2017                          
  yas30_4682                                 YAST30-4682_2017                          
  yas30_4686                                 YAST30-4686_2017                          
  yas30_4270                                 YAST30-4270_2017                          
  yas30_4290                                 YAST30-4290_2017                          
  yas30_4292                                 YAST30-4292_2017                          
  yas30_4294l                                YAST30-4294_000001_2017                   
  yas30_4294u                                YAST30-4294_000002_2017                   
  yas30_4296                                 YAST30-4296_2017                          
  yas30_fa_8                                 YAST30-FA_8_2017                          
  yas30_fa_8a000001                          YAST30-FA_8A~000001_2017                  
  yas30_fa_8a000002                          YAST30-FA_8A~000002_2017                  
  yas30_fa_8a000003                          YAST30-FA_8A~000003_2017                  
  yas30_fa_8a000004                          YAST30-FA_8A~000004_2017                  
  yas30_fa_8a000005                          YAST30-FA_8A~000005_2017                  
  yas30_fa_8a000006                          YAST30-FA_8A~000006_2017                  
  yas30_fa_8a000007                          YAST30-FA_8A~000007_2017                  
  yas30_fa_8_inselection_01                  YAST30-FA_8-INSELECTION.01_2017           
  yas30_fa_8_inselection_02                  YAST30-FA_8-INSELECTION.02_2017           
  yas30_fa_8_inselection_03                  YAST30-FA_8-INSELECTION.03_2017           
  yas30_fa_8_inselection_04                  YAST30-FA_8-INSELECTION.04_2017           
  yas30_fa_8_inselection_05                  YAST30-FA_8-INSELECTION.05_2017           
  yas30_fa_8_inselection_06                  YAST30-FA_8-INSELECTION.06_2017           
  yas30_fa_8_inselection_07                  YAST30-FA_8-INSELECTION.07_2017           
  yas30_fa_8_inselection_08                  YAST30-FA_8-INSELECTION.08_2017           
  yas30_fa_8_inselection_09                  YAST30-FA_8-INSELECTION.09_2017           
  yas30_fa_8b_01                             YAST30-FA_8B.01_2017                      
  yas30_fa_8b_02                             YAST30-FA_8B.02_2017                      
  yas30_fa_8b_06                             YAST30-FA_8B.06_2017                      
  yas30_fa_8c1_01                            YAST30-FA_8C1.01_2017                     
  yas30_fa_8c1_02                            YAST30-FA_8C1.02_2017                     
  yas30_fa_8c2_01                            YAST30-FA_8C2.01_2017                     
  yas30_fa_8c2_02                            YAST30-FA_8C2.02_2017                     
  yas30_fa_8d_01                             YAST30-FA_8D.01_2017                      
  yas30_fa_8d_02                             YAST30-FA_8D.02_2017                      
  yas30_fa_8d_06                             YAST30-FA_8D.06_2017                      
  yas30_4300                                 YAST30-4300_2017                          
  yas30_4300a                                YAST30-4300A_2017                         
  yas30_4300a1                               YAST30-4300A1_2017                        
  yas30_4790                                 YAST30-4790_2017                          
  yas30_4810                                 YAST30-4810_2017                          
  yas30_4812                                 YAST30-4812_2017                          
  yas30_4816                                 YAST30-4816_2017                          
  yas30_4840                                 YAST30-4840_2017                          
  yas30_4842                                 YAST30-4842_2017                          
  yas30_4010                                 YAST30-4010_2017                          
  yas30_4010a2a                              YAST30-4010A2A_2017                       
  yas30_4030a_01                             YAST30-4030A.01_2017                      
  yas30_4030a_02                             YAST30-4030A.02_2017                      
  yas30_4030a_03                             YAST30-4030A.03_2017                      
  yas30_4030a_04                             YAST30-4030A.04_2017                      
  yas30_4032_01                              YAST30-4032.01_2017                       
  yas30_4032_02                              YAST30-4032.02_2017                       
  yas30_4032_03                              YAST30-4032.03_2017                       
  yas30_4032_04                              YAST30-4032.04_2017                       
  yas30_4033al_01                            YAST30-4033A_000001.01_2017               
  yas30_4033au_01                            YAST30-4033A_000002.01_2017               
  yas30_4140                                 YAST30-4140_2017                          
  yas30_4160                                 YAST30-4160_2017                          
  yas30_4162                                 YAST30-4162_2017                          
  yas30_4870                                 YAST30-4870_2017                          
  yas30_4880                                 YAST30-4880_2017                          
  yas30_4900                                 YAST30-4900_2017                          
  yas30_4902                                 YAST30-4902_2017                          
  yas30_5011                                 YAST30-5011_2017                          
  yas30_5011a                                YAST30-5011A_2017                         
  yas30_5012                                 YAST30-5012_2017                          
  yas30_5014                                 YAST30-5014_2017                          
  yas30_5015                                 YAST30-5015_2017                          
  yas30_5015a                                YAST30-5015A_2017                         
  yas30_5016                                 YAST30-5016_2017                          
  yas30_5018                                 YAST30-5018_2017                          
  yas30_5019                                 YAST30-5019_2017                          
  yas30_5040_new                             YAST30-5040_NEW_2017                      
  yas30_5074_new                             YAST30-5074_NEW_2017                      
  yas30_5082_new                             YAST30-5082_NEW_2017                      
  yas30_5084l_new                            YAST30-5084_000001_NEW_2017               
  yas30_5084u_new                            YAST30-5084_000002_NEW_2017               
  yas30_5086_new                             YAST30-5086_NEW_2017                      
  yas30_5130                                 YAST30-5130_2017                          
  yas30_5170                                 YAST30-5170_2017                          
  yas30_5172                                 YAST30-5172_2017                          
  yas30_5210a                                YAST30-5210A_2017                         
  yas30_5210aa                               YAST30-5210AA_2017                        
  yas30_5210a1                               YAST30-5210A1_2017                        
  yas30_5210a2                               YAST30-5210A2_2017                        
  yas30_5210a4                               YAST30-5210A4_2017                        
  yas30_5210b1                               YAST30-5210B1_2017                        
  yas30_5210c1                               YAST30-5210C1_2017                        
  yas30_5210c2                               YAST30-5210C2_2017                        
  yas30_5210d1                               YAST30-5210D1_2017                        
  yas30_5210d1a                              YAST30-5210D1A_2017                       
  yas30_5210d2                               YAST30-5210D2_2017                        
  yas30_5250                                 YAST30-5250_2017                          
  yas30_5260                                 YAST30-5260_2017                          
  yas30_5280                                 YAST30-5280_2017                          
  yas30_5282                                 YAST30-5282_2017                          
  yas30_5282n                                YAST30-5282N_2017                         
  yas30_5284nl                               YAST30-5284N_000001_2017                  
  yas30_5284nu                               YAST30-5284N_000002_2017                  
  yas30_5286                                 YAST30-5286_2017                          
  yas30_5310                                 YAST30-5310_2017                          
  yas30_5320                                 YAST30-5320_2017                          
  yas30_5322                                 YAST30-5322_2017                          
  yas30_5326                                 YAST30-5326_2017                          
  yas30_5410                                 YAST30-5410_2017                          
  yas30_5411                                 YAST30-5411_2017                          
  yas30_5420                                 YAST30-5420_2017                          
  yas30_5421                                 YAST30-5421_2017                          
  yas30_5422m                                YAST30-5422~M_2017                        
  yas30_5422y                                YAST30-5422~Y_2017                        
  yas30_5423                                 YAST30-5423_2017                          
  hhi4400a                                   YHHI-4400A_2017                           
  hhi4400x                                   YHHI-4400X_2017                           
  e24600_11                                  YSCH-24600.01.01_2017                     
  e24600_21                                  YSCH-24600.02.01_2017                     
  e24600_22                                  YSCH-24600.02.02_2017                     
  e24600_24                                  YSCH-24600.02.04_2017                     
  e24600_31                                  YSCH-24600.03.01_2017                     
  e24600_51                                  YSCH-24600.05.01_2017                     
  e24600_55                                  YSCH-24600.05.05_2017                     
  e24700_11                                  YSCH-24700.01.01_2017                     
  e24700_21                                  YSCH-24700.02.01_2017                     
  e24700_22                                  YSCH-24700.02.02_2017                     
  e24700_24                                  YSCH-24700.02.04_2017                     
  e24700_31                                  YSCH-24700.03.01_2017                     
  e24700_51                                  YSCH-24700.05.01_2017                     
  e24700_55                                  YSCH-24700.05.05_2017                     
  e24800_11                                  YSCH-24800.01.01_2017                     
  e24800_21                                  YSCH-24800.02.01_2017                     
  e24800_22                                  YSCH-24800.02.02_2017                     
  e24800_24                                  YSCH-24800.02.04_2017                     
  e24800_31                                  YSCH-24800.03.01_2017                     
  e24800_51                                  YSCH-24800.05.01_2017                     
  e24900_11                                  YSCH-24900.01.01_2017                     
  e25600_11                                  YSCH-25600.01.01_2017                     
  e25600_12                                  YSCH-25600.01.02_2017                     
  e25600_13                                  YSCH-25600.01.03_2017                     
  e25600_14                                  YSCH-25600.01.04_2017                     
  e25600_15                                  YSCH-25600.01.05_2017                     
  e25600_16                                  YSCH-25600.01.06_2017                     
  e25600_17                                  YSCH-25600.01.07_2017                     
  e25600_18                                  YSCH-25600.01.08_2017                     
  e25600_21                                  YSCH-25600.02.01_2017                     
  e25600_22                                  YSCH-25600.02.02_2017                     
  e25600_51                                  YSCH-25600.05.01_2017                     
  e25700_11                                  YSCH-25700.01.01_2017                     
  e25700_12                                  YSCH-25700.01.02_2017                     
  e25700_13                                  YSCH-25700.01.03_2017                     
  e25700_14                                  YSCH-25700.01.04_2017                     
  e25700_15                                  YSCH-25700.01.05_2017                     
  e25700_16                                  YSCH-25700.01.06_2017                     
  e25700_17                                  YSCH-25700.01.07_2017                     
  e25700_18                                  YSCH-25700.01.08_2017                     
  e25700_21                                  YSCH-25700.02.01_2017                     
  e25700_22                                  YSCH-25700.02.02_2017                     
  e25700_51                                  YSCH-25700.05.01_2017                     
  e25800_11                                  YSCH-25800.01.01_2017                     
  e25800_12                                  YSCH-25800.01.02_2017                     
  e25800_21                                  YSCH-25800.02.01_2017                     

SAS Code for Variable Creation

/******************compute family and government educational debt collected in schooling section****************/

array e24800 e24800_11 e24800_21 e24800_22 e24800_24 e24800_31 e24800_51;
array e24900 e24900_11 dum dum dum dum dum;
array e25700 e25700_11-e25700_18 e25700_21-e25700_22 e25700_51;
array e25800 e25800_11 e25800_12 dum dum dum dum dum dum e25800_21 e25800_22 dum;

do over e24800;
 if e24800 in (-1 -2) & e24900>0 then do;
 if e24900=1 then e24800=500;
 else if e24900=2 then e24800=1750;
 else if e24900=3 then e24800=3750;
 else if e24900=4 then e24800=7500;
 else if e24900=5 then e24800=17500;
 else if e24900=6 then e24800=37500;
 else if e24900=7 then e24800=50001;
do over e25700;
 if e25700 in (-1 -2) & e25800>0 then do;
 if e25800=1 then e25700=500;
 else if e25800=2 then e25700=1750;
 else if e25800=3 then e25700=3750;
 else if e25800=4 then e25700=7500;
 else if e25800=5 then e25700=17500;
 else if e25800=6 then e25700=37500;
 else if e25800=7 then e25700=50001;

do over e24800;
 if e24800>0 then famedudebt_c=famedudebt_c+e24800;
do over e24800;
 if e24800 in (-1 -2 -3) then famedudebt_c=-3;

do over e25700;
 if e25700>0 then govdebt_c=govdebt_c+e25700;
do over e25700;
 if e25700 in (-1 -2 -3) then govdebt_c=-3;

/*******************************start of the assets section (hhworthy)****************************************************/
/* */
/* first create the components of hhworth30: real estate, loans, cars, etc. each sub-section computes one item */
/* of the total asset of the respondent and his/her spouse or partner. flag variables are created to indicate whether */
/* r/family received that asset item (flag_item in (1,2,-3) and if so, was the amount computed directly from the amount */
/* reported by respondent (flag_item=1) or was it computed from estimates given by respondent (flag_item=2), or was */
/* it unable to be computed (flag_item=-3). */

/* initialize the variable to housing_type= don't own, house_value = 0 */
housing_type=6 ;
house_value=0 ;

/****************** assets section 1: residence *************************************************/

hhi4400 = -4;
if (hhi4400a > -4) then hhi4400 = hhi4400a;
else if (hhi4400x > -4) then hhi4400 = hhi4400x;

if yhou_dlimortgage=1 or yhou_dliown2=1 or yhou_ch1 in (1 2 3 4 5) then

if hhi4400=1 then housing_type=1;
 else if hhi4400=12 then housing_type=2;
 else if hhi4400=8 then housing_type=3;
 else do;
 housing_type=9; *own but house type unknown;

if yhou_housevalue=1 & yhou_chhva>=0 then house_value=yhou_chhva;
 else if yhou_housevalue=2 & yhou_chhvbl>=0 & yhou_chhvbu>=0 then
 if yhou_chhvbu>=yhou_chhvbl then house_value = (yhou_chhvbu + yhou_chhvbl)/2;
 else house_value=-3;
 if yhou_housevalue not in (1,2) or yhou_chhva in (-1, -2) then
 if 1<=yhou_chhvc<=7 then flag_house=2;
 if yhou_chhvc=1 then house_value=12500;
 else if yhou_chhvc=2 then house_value=37500;
 else if yhou_chhvc=3 then house_value=75000;
 else if yhou_chhvc=4 then house_value=175000;
 else if yhou_chhvc=5 then house_value=375000;
 else if yhou_chhvc=6 then house_value=750000;
 else if yhou_chhvc=7 then house_value=1000001;

if yhou_ch1 in (-1 -2 -3) or yhou_chhvbu in (-1 -2 -3) or yhou_chhvbl in (-1 -2 -3) or yhou_chhvc in (-1 -2 -3) then house_value=-3;
if yhou_ch1 in (-1 -2 -3) then housing_type=-3; *not knowing own or not own;

if yas30_age30elig2 ne 1 then do;

/*****************************assets section 2: owning business-pvbuss*********************************************/

/* asset30 adjusted for questions skipped or not in r18 */
* yas30_4032_04 = -4;
yas30_4032_05 = -4;
yas30_4032a_02 = -4;
yas30_4032a_03 = -4;
yas30_4032a_04 = -4;
yas30_4032a_05 = -4;
yas30_4033al_02 = -4;
yas30_4033al_03 = -4;
yas30_4033al_04 = -4;
yas30_4033al_05 = -4;
yas30_4033au_02 = -4;
yas30_4033au_03 = -4;
yas30_4033au_04 = -4;
yas30_4033au_05 = -4;
yas30_4034al_01 = -4;
yas30_4034al_02 = -4;
yas30_4034al_03 = -4;
yas30_4034al_04 = -4;
yas30_4034al_05 = -4;
yas30_4034au_01 = -4;
yas30_4034au_02 = -4;
yas30_4034au_03 = -4;
yas30_4034au_04 = -4;
yas30_4034au_05 = -4;
yas30_4036_02 = -4;
yas30_4036_03 = -4;
yas30_4036_04 = -4;
yas30_4036_05 = -4;
yas30_4036a_02 = -4;
yas30_4036a_03 = -4;
yas30_4036a_04 = -4;
yas30_4036a_05 = -4;

/**** create array for business variables because some own multiple businesses ****/

array pvbuss (*) pvbuss_01 - pvbuss_04; /* pv of business */
 array yas30_4030a (*) yas30_4030a_01 - yas30_4030a_05; /* make, lose or even */
 array yas30_4032 (*) yas30_4032_01 - yas30_4032_05; /* amount make */
 array yas30_4032a (*) yas30_4032a_01 - yas30_4032a_05; /* amount lose */
 array yas30_4033al(*) yas30_4033al_01 - yas30_4033al_05; /* amount make lower bound */
 array yas30_4033au(*) yas30_4033au_01 - yas30_4033au_05; /* amount make upper bound */
 array yas30_4034al(*) yas30_4034al_01 - yas30_4034al_05; /* amount lose lower bound */
 array yas30_4034au(*) yas30_4034au_01 - yas30_4034au_05; /* amount lose upper bound */
 array yas30_4036 (*) yas30_4036_01 - yas30_4036_05; /* amount make, estimate */
 array yas30_4036a (*) yas30_4036a_01 - yas30_4036a_05; /* amount lose, estimate */

do i=1 to dim(pvbuss);
 pvbuss(i)= -4;
 if yas30_4010=1 then
 flag_pvbuss =1;
 if yas30_4030a(i)=1 then
 if yas30_4032a(i)>=0 then pvbuss(i)=yas30_4032a(i);
 else if yas30_4032a(i) in (-1, -2) then
 if yas30_4034au(i)>=yas30_4034al(i) and yas30_4034au(i)>=0 and yas30_4034al(i)>=0 then pvbuss(i)=(yas30_4034al(i) + yas30_4034au(i))/2;
 else pvbuss(i)=-3;
 if yas30_4034au(i) in (-1, -2) then
 if 1 <= yas30_4036a(i)<=7 then flag_pvbuss=2;
 if yas30_4036a(i)=1 then pvbuss(i)=12500;
 else if yas30_4036a(i)=2 then pvbuss(i)=37500;
 else if yas30_4036a(i)=3 then pvbuss(i)=75000;
 else if yas30_4036a(i)=4 then pvbuss(i)=175000;
 else if yas30_4036a(i)=5 then pvbuss(i)=375000;
 else if yas30_4036a(i)=6 then pvbuss(i)=750000;
 else if yas30_4036a(i)=7 then pvbuss(i)=1000001;
 if pvbuss(i)>0 then pvbuss(i)=-1*pvbuss(i);
 else if yas30_4030a(i)=2 then
 if yas30_4032(i)>=0 then pvbuss(i)=yas30_4032(i);
 else if yas30_4032(i) in (-1, -2) then
 if yas30_4033au(i)>=yas30_4033al(i) and yas30_4033au(i)>=0 and yas30_4033al(i)>=0 then pvbuss(i)=(yas30_4033al(i) + yas30_4033au(i))/2;
 else pvbuss(i)=-3;
 if yas30_4033au(i) in (-1, -2) then
 if 1<=yas30_4036(i)<=7 then flag_pvbuss=2;
 if yas30_4036(i)=1 then pvbuss(i)=12500;
 else if yas30_4036(i)=2 then pvbuss(i)=37500;
 else if yas30_4036(i)=3 then pvbuss(i)=75000;
 else if yas30_4036(i)=4 then pvbuss(i)=175000;
 else if yas30_4036(i)=5 then pvbuss(i)=375000;
 else if yas30_4036(i)=6 then pvbuss(i)=750000;
 else if yas30_4036(i)=7 then pvbuss(i)=1000001;
 else if yas30_4030a(i)=3 then pvbuss(i)=0;

if yas30_4010=-1 or yas30_4030a(i)=-1 or yas30_4036a(i)=-1 or yas30_4036(i)= -1 then pvbuss(i)=-1;
 if yas30_4010=-2 or yas30_4030a(i)=-2 or yas30_4036a(i)=-2 or yas30_4036(i)= -2 then pvbuss(i)=-2;
 if yas30_4010=-3 or yas30_4030a(i)=-3 or yas30_4036a(i)=-3 or yas30_4036(i)= -3 then pvbuss(i)=-3;

/**************************assets section 3: ownership of other real-estate : othreal**********************************/

/* asset30 adjusted for questions skipped in r18 */
yas30_4164nl = -4;
yas30_4164nu = -4;
yas30_4164u = -4;
yas30_4164l = -4;
yas30_4162n = -4;
yas30_4166 = -4;


if yas30_4140=1 then
 if yas30_4160=1 & yas30_4162>=0 then othreal=yas30_4162;
 else if yas30_4160=2 & yas30_4164u>=0 & yas30_4164l>=0 then
 if yas30_4164u>=yas30_4164l then othreal=(yas30_4164l+yas30_4164u)/2;
 else othreal=-3;
 else if yas30_4160=3 & yas30_4162n>=0 then othreal=-(yas30_4162n);
 else if yas30_4160=4 & yas30_4164nu>=0 & yas30_4164nl>=0 then
 if yas30_4164nu>=yas30_4164nl then othreal=-(yas30_4164nl+yas30_4164nu)/2;
 else othreal=-3;

if yas30_4160 not in (1,2,3,4) or yas30_4162 in (-1, -2) then
 if 1<=yas30_4166<=7 then flag_othreal=2;
 if yas30_4166=1 then othreal=12500;
 else if yas30_4166=2 then othreal=37500;
 else if yas30_4166=3 then othreal=75000;
 else if yas30_4166=4 then othreal=175000;
 else if yas30_4166=5 then othreal=375000;
 else if yas30_4166=6 then othreal=750000;
 else if yas30_4166=7 then othreal=1000001;

if yas30_4140 in (-1 -2 -3) or yas30_4164l in (-1 -2 -3) or yas30_4164u in (-1 -2 -3)
 or yas30_4164nl in (-1 -2 -3) or yas30_4164nu in (-1 -2 -3) or yas30_4166 in (-1 -2 -3) then othreal =-3;

/*****************assets section 4: retirement plans or pensions--retdsav***********************************************/


if yas30_4270=1 or yas30_4000s6=1 then
 if yas30_4290=1 & yas30_4292>=0 then retdsav=yas30_4292;
 else if yas30_4290=2 and yas30_4294u>=0 and yas30_4294l>=0 then
 if yas30_4294u>=yas30_4294l then retdsav = (yas30_4294l + yas30_4294u)/2;
 else retdsav =-3;
 if yas30_4290 not in (1,2) or yas30_4292 in (-1, -2) then
 if 1<=yas30_4296<=8 then flag_retdsav=2;
 if yas30_4296=1 then retdsav=2500;
 else if yas30_4296=2 then retdsav= 7500;
 else if yas30_4296=3 then retdsav=17500;
 else if yas30_4296=4 then retdsav=37500;
 else if yas30_4296=5 then retdsav=75000;
 else if yas30_4296=6 then retdsav=175000;
 else if yas30_4296=7 then retdsav=375000;
 else if yas30_4296=8 then retdsav=500001;

if yas30_4270 in (-1 -2 -3) or yas30_4294l in (-1 -2 -3)
 or yas30_4294u in (-1 -2 -3) or yas30_4296 in (-1 -2 -3) then retdsav=-3;

/*****************assets section 5: tax advanged accounts, ira etc.--ira*************************************/

/* asset30 adjusted for questions skipped or not in r18 */
yas30_fa_8b_03 = -4;
yas30_fa_8b_04 = -4;
yas30_fa_8b_05 = -4;
yas30_fa_8b_07 = -4;
* yas30_fa_8c1_01 = -4;
* yas30_fa_8c1_02 = -4;
yas30_fa_8c1_03 = -4;
yas30_fa_8c1_04 = -4;
yas30_fa_8c1_05 = -4;
yas30_fa_8c1_06 = -4;
yas30_fa_8c1_07 = -4;
* yas30_fa_8c2_01 = -4;
* yas30_fa_8c2_02 = -4;
yas30_fa_8c2_03 = -4;
yas30_fa_8c2_04 = -4;
yas30_fa_8c2_05 = -4;
yas30_fa_8c2_06 = -4;
yas30_fa_8c2_07 = -4;
yas30_fa_8d_03 = -4;
yas30_fa_8d_04 = -4;
yas30_fa_8d_05 = -4;
yas30_fa_8d_07 = -4;

array ira (*) ira_01 - ira_07; /* pv of tax ad. accts */
 array ira_w (*) ira_w_01 - ira_w_07; /* withdrawl intended to pay back */
 array ira_t (*) ira_t_01 - ira_t_07; /* total after intended payback withdrawl */
 array yas30_fa_8a (*) yas30_fa_8a000001 - yas30_fa_8a000007; /* type of the accts */
 array yas30_fa_8b (*) yas30_fa_8b_01 - yas30_fa_8b_07; /* withdraw or not */
 array yas30_fa_8c1 (*) yas30_fa_8c1_01 - yas30_fa_8c1_07; /*amt int to payback*/
 array yas30_fa_8c2 (*) yas30_fa_8c2_01 - yas30_fa_8c2_07; /* enter amt int to payback*/
 array yas30_fa_8c4 (*) yas30_fa_8c4_01 - yas30_fa_8c4_07; /* estimate amt int to payback*/ /* kn note: added */
 array yas30_fa_8d (*) yas30_fa_8d_01 - yas30_fa_8d_07; /* ttl after pay back */

do i=1 to dim(ira);
 ira(i)= -4;
 if yas30_fa_8=1 then do;
 flag_ira =1;
 if yas30_fa_8a(i)=1 then do;
 if yas30_fa_8b(i)=1 then do;
 if yas30_fa_8c1(i)=1 & yas30_fa_8c2(i)>=0 then ira_w(i)=yas30_fa_8c2(i);

else if yas30_fa_8c2(i) in(-1, -2) & yas30_fa_8c4(i) > 0 then do; *kn note: added to catch estimates of payback amt apr 17 2019;
 if 1<=yas30_fa_8c4(i)<=7 then flag_ira=2;
 if yas30_fa_8c4(i)=1 then ira_w(i)=2500;
 else if yas30_fa_8c4(i)=2 then ira_w(i)=7500;
 else if yas30_fa_8c4(i)=3 then ira_w(i)=17500;
 else if yas30_fa_8c4(i)=4 then ira_w(i)=37500;
 else if yas30_fa_8c4(i)=5 then ira_w(i)=75000;
 else if yas30_fa_8c4(i)=6 then ira_w(i)=175000;
 else if yas30_fa_8c4(i)=7 then ira_w(i)=250001;
 else if yas30_fa_8b(i)=0 then ira_w(i)=0;
 else ira_w(i)=-3;
 if yas30_fa_8d(i)>=0 then ira_t(i)=yas30_fa_8d(i);
 else ira_t(i)=-3;
 if ira_w(i)>=0 & ira_t(i)>=0 then ira(i)=ira_t(i)-ira_w(i);
 else if ira_w(i)=-3 or ira_t(i)=-3 then ira(i)=-3;
 else if yas30_fa_8a(i) in (-1 -2 -3) then ira(i)=-3;
 if yas30_fa_8 in (-1 -2 -3) then ira(i)=-3;

/**********************assets section 6: bank savings--banksav*************************************************************/


if yas30_4400=1 or yas30_4000s4=1 then
 if yas30_4420=1 & yas30_4422>=0 then banksav=yas30_4422;
 else if yas30_4420=2 & yas30_4424u>=0 & yas30_4424l>=0 then
 if yas30_4424u>=yas30_4424l then banksav = (yas30_4424u + yas30_4424l)/2;
 else banksav=-3;
 if yas30_4420 not in (1,2) or yas30_4422 in (-1, -2) then
 if 1<=yas30_4426<=9 then flag_banksav=2;
 if yas30_4426=1 then banksav=500;
 else if yas30_4426=2 then banksav=1750;
 else if yas30_4426=3 then banksav=3750;
 else if yas30_4426=4 then banksav=7500;
 else if yas30_4426=5 then banksav=17500;
 else if yas30_4426=6 then banksav=37500;
 else if yas30_4426=7 then banksav=75000;
 else if yas30_4426=8 then banksav=175000;
 else if yas30_4426=9 then banksav=250001;

if yas30_4400 in (-1 -2 -3) or yas30_4424l in (-1 -2 -3) or yas30_4424u in (-1 -2 -3)
 or yas30_4426 in (-1 -2 -3) or yas30_4422=-3 then banksav=-3;

/************************************assets section 7: other bank savings-bonds****************************************/

/**if r or r's partner/spouse jointly have other bank savings in cds or bonds**/


/* asset30 adjusted for questions skipped or not in r18 */
yas30_4554u = -4;
yas30_4554l = -4;
yas30_4556 = -4;

if yas30_4530=1 then
 if yas30_4550=1 & yas30_4552>=0 then bonds=yas30_4552;
 else if yas30_4550=2 & yas30_4554u>=0 & yas30_4554l>=0 then
 if yas30_4554u>=yas30_4554l then bonds = (yas30_4554u + yas30_4554l)/2;
 else bonds=-3;
 if yas30_4550 not in (1,2) or yas30_4552 in (-1, -2) then
 if 1<=yas30_4556<=9 then flag_bonds=2;
 if yas30_4556=1 then bonds=500;
 else if yas30_4556=2 then bonds=1750;
 else if yas30_4556=3 then bonds=3750;
 else if yas30_4556=4 then bonds=7500;
 else if yas30_4556=5 then bonds=17500;
 else if yas30_4556=6 then bonds=37500;
 else if yas30_4556=7 then bonds=75000;
 else if yas30_4556=8 then bonds=175000;
 else if yas30_4556=9 then bonds=250001;

if yas30_4530 in (-1 -2 -3) or yas30_4554l in (-1 -2 -3) or yas30_4554u in (-1 -2 -3)
 or yas30_4556 in (-1 -2 -3) or yas30_4552=-3 then bonds=-3;

/********assets section 8: owning stocks--stocks****************************************************/


/* asset30 adjusted for questions skipped or not in r18 */
yas30_4684l = -4;
yas30_4684u = -4;

if yas30_4660=1 then
 if yas30_4680=1 & yas30_4682>=0 then stocks=yas30_4682;
 else if yas30_4680=2 & yas30_4684l>=0 & yas30_4684u>=0 then
 if yas30_4684u>=yas30_4684l then stocks=(yas30_4684l+yas30_4684u)/2;
 else stocks=-3;
 if yas30_4680 not in (1,2) or yas30_4682 in (-1,-2) then
 if 1<=yas30_4686<=9 then flag_stocks=2;
 if yas30_4686=1 then stocks=500;
 else if yas30_4686=2 then stocks=1750;
 else if yas30_4686=3 then stocks=3750;
 else if yas30_4686=4 then stocks=7500;
 else if yas30_4686=5 then stocks=17500;
 else if yas30_4686=6 then stocks=37500;
 else if yas30_4686=7 then stocks=75000;
 else if yas30_4686=8 then stocks=175000;
 else if yas30_4686=9 then stocks=250001;

if yas30_4660 in (-1 -2 -3) or yas30_4684l in (-1 -2 -3) or yas30_4684u in (-1 -2 -3)
 or yas30_4686 in (-1 -2 -3) or yas30_4682=-3 then stocks=-3;

 /************assets section 9: vehicle ownership-pvcars********************************/


/* asset30 adjusted for questions skipped or not in r18 */
yas30_4814l = -4;
yas30_4814u = -4;

if yas30_4790=1 then
 if yas30_4810=1 & yas30_4812>=0 then pvcars1=yas30_4812;
 else if yas30_4810=2 & yas30_4814l>=0 & yas30_4814u>=0 then
 if yas30_4814u>=yas30_4814l then pvcars1=(yas30_4814l+yas30_4814u)/2;
 else pvcars1=-3;
 if yas30_4810 not in (1,2) or yas30_4812 in (-1,-2) then
 if 1<=yas30_4816<=7 then flag_pvcars1=2;
 if yas30_4816=1 then pvcars1=2500;
 else if yas30_4816=2 then pvcars1=7500;
 else if yas30_4816=3 then pvcars1=17500;
 else if yas30_4816=4 then pvcars1=37500;
 else if yas30_4816=5 then pvcars1=75000;
 else if yas30_4816=6 then pvcars1=175000;
 else if yas30_4816=7 then pvcars1=250001;
if yas30_4790 in (-1 -2 -3) or yas30_4814l in (-1 -2 -3) or yas30_4814u in (-1 -2 -3)
 or yas30_4816 in (-1 -2 -3) or yas30_4812=-3 then pvcars1=-3;

 /************assets section 9.2: secondary source of info on vehicle ownership, pvcars2 ********************************/

/* asset30 adjusted for questions skipped or not in r18 */
yas30_4000s9bl = -4;
yas30_4000s9bu = -4;
yas30_4000s9c = -4;


if yas30_4000s8 =1 then
 if yas30_4000s9 =1 and yas30_4000s9a>=0 then pvcars2= yas30_4000s9a;
 else if yas30_4000s9 = 2 and yas30_4000s9bl>=0 and yas30_4000s9bu>=0 then
 if yas30_4000s9bu>= yas30_4000s9bl then pvcars2=(yas30_4000s9bu+yas30_4000s9bl)/2;
 else pvcars2=-3;
 if yas30_4000s9 not in (1,2) or yas30_4000s9a in (-1,-2) then
 if 1<= yas30_4000s9c <=8 then flag_pvcars2=2;
 if yas30_4000s9c=1 then pvcars2 = 500;
 else if yas30_4000s9c=2 then pvcars2= 1750;
 else if yas30_4000s9c=3 then pvcars2= 3750;
 else if yas30_4000s9c=4 then pvcars2= 7500;
 else if yas30_4000s9c=5 then pvcars2= 17500;
 else if yas30_4000s9c=6 then pvcars2= 37500;
 else if yas30_4000s9c=7 then pvcars2= 75000;
 else if yas30_4000s9c=8 then pvcars2= 100001;

if yas30_4000s8 in (-1 -2 -3) or yas30_4000s9bl in (-1 -2 -3) or yas30_4000s9bu in (-1 -2 -3)
 or yas30_4000s9c in (-1 -2 -3) then pvcars2=-3;

 /*********************assets section 10: furniture value--pvfurn***************************************************/


if yas30_4870>-4 then flag_pvfurn=1;
if yas30_4870=1 then pvfurn=2500;
else if yas30_4870=2 then pvfurn=7500;
else if yas30_4870=3 then pvfurn=17500;
else if yas30_4870=4 then pvfurn=37500;
else if yas30_4870=5 then pvfurn=75000;
else if yas30_4870=6 then pvfurn=175000;
else if yas30_4870=7 then pvfurn=250001;
else if yas30_4870=8 then pvfurn=0;
else if yas30_4870=-1 then pvfurn=-1;
else if yas30_4870=-2 then pvfurn=-2;
else if yas30_4870=-3 then pvfurn=-3;

/***********************assets section 11: other assets-othsav***************************************/


/* asset30 adjusted for questions skipped or not in r18 */
yas30_4904l = -4;
yas30_4904u = -4;
yas30_4906 = -4;

if yas30_4880=1 then
 if yas30_4900=1 & yas30_4902>=0 then othsav=yas30_4902;
 else if yas30_4900=2 & yas30_4904l>=0 & yas30_4904u>=0 then
 if yas30_4904u>=yas30_4904l then othsav=(yas30_4904u+yas30_4904l)/2;
 else othsav=-3;
 if yas30_4900 not in (1,2) or yas30_4902 in (-1,-2) then
 if 1<=yas30_4906<=7 then flag_othsav=2;
 if yas30_4906=1 then othsav=2500;
 else if yas30_4906=2 then othsav=7500;
 else if yas30_4906=3 then othsav=17500;
 else if yas30_4906=4 then othsav=37500;
 else if yas30_4906=5 then othsav=75000;
 else if yas30_4906=6 then othsav=175000;
 else if yas30_4906=7 then othsav=250001;

if yas30_4880=-1 or yas30_4904l=-1 or yas30_4904u=-1 or yas30_4906=-1 then othsav=-1;
if yas30_4880=-2 or yas30_4904l=-2 or yas30_4904u=-2 or yas30_4906=-2 then othsav=-2;
if yas30_4880=-3 or yas30_4904l=-3 or yas30_4904u=-3 or yas30_4906=-3 or yas30_4902=-3 then othsav=-3;

/***************assets section 12: outstanding loans-loans****************************************/

/* asset30 adjusted for questions skipped or not in r18 */
yas30_4300bu = -4;
yas30_4300bl = -4;
yas30_4300a2 = -4;


if yas30_4300 in (1,2,3) then
 if yas30_4300a=1 & yas30_4300a1>=0 then loans=yas30_4300a1;
else if yas30_4300a=2 & yas30_4300bl>=0 & yas30_4300bu>=0 then
 if yas30_4300bu>=yas30_4300bl then loans=(yas30_4300bu+yas30_4300bl)/2;
 else loans=-3;
 if yas30_4300a not in (1,2) or yas30_4300a1 in (-1,-2) then
 if 1<=yas30_4300a2<=7 then flag_loans=2;
 if yas30_4300a2=1 then loans=2500;
 else if yas30_4300a2=2 then loans=7500;
 else if yas30_4300a2=3 then loans=17500;
 else if yas30_4300a2=4 then loans=37500;
 else if yas30_4300a2=5 then loans=75000;
 else if yas30_4300a2=6 then loans=175000;
 else if yas30_4300a2=7 then loans=250001;

if yas30_4300=-1 or yas30_4300a2=-1 or yas30_4300bl=-1 or yas30_4300bu=-1 then loans=-1;
if yas30_4300=-2 or yas30_4300a2=-2 or yas30_4300bu=-2 or yas30_4300bu=-2 then loans=-2;
if yas30_4300=-3 or yas30_4300a2=-3 or yas30_4300bu=-3 or yas30_4300bu=-3 or yas30_4300a1=-3 then loans=-3;

 begin liabilities section

/********************liabilites section 1: mortgage or land contract-mortgag************/


if yhou_dlimortgage=1 or yhou_dliown2=1 or yhou_ch1 in (1 2 3 4 5) then do;

if yhou_dlimortgage=1 or yhou_ch6=1 then
 if yhou_ch7=1 & yhou_ch7a>=0 then mortgag=yhou_ch7a;
 else if yhou_ch7=2 & yhou_ch7bl>=0 & yhou_ch7bu>=0 then
 if yhou_ch7bu>=yhou_ch7bl then mortgag = (yhou_ch7bl+yhou_ch7bu)/2;
 else mortgag=-3;
 if yhou_ch7 not in (1,2) or yhou_ch7a in (-1,-2) then
 if 1<=yhou_ch7c<=7 then flag_mortgag=2;
 if yhou_ch7c=1 then mortgag=12500;
 else if yhou_ch7c=2 then mortgag=37500;
 else if yhou_ch7c=3 then mortgag=75000;
 else if yhou_ch7c=4 then mortgag=175000;
 else if yhou_ch7c=5 then mortgag=375000;
 else if yhou_ch7c=6 then mortgag=750000;
 else if yhou_ch7c=7 then mortgag=1000001;

if yhou_ch1 in (-1 -2 -3) or yhou_ch6 in (-1 -2 -3) or yhou_ch7bl in (-1 -2 -3) or yhou_ch7bu in (-1 -2 -3) or yhou_ch7c in (-1 -2 -3) then mortgag=-3;

/********************liabilities section 2: family mortgage debt-resdebt***********************/

/* asset30 adjusted for questions skipped or not in r18 */
 yas30_ch10c = -4;


if yhou_dlimortgage=1 or yhou_dliown2=1 or yhou_ch1 in (1 2 3 4 5) then do;
 if yas30_ch9=1 then do;
 if yas30_ch10=1 & yas30_ch10a>=0 then resdebt=yas30_ch10a;
 else if yas30_ch10 not in (1 2) or yas30_ch10a in (-1 -2) then do;
 if 1=<yas30_ch10c<=7 then flag_resdebt=2;
 if yas30_ch10c=1 then resdebt=12500;
 else if yas30_ch10c=2 then resdebt=37500;
 else if yas30_ch10c=3 then resdebt=75000;
 else if yas30_ch10c=4 then resdebt=175000;
 else if yas30_ch10c=5 then resdebt=375000;
 else if yas30_ch10c=6 then resdebt=750000;
 else if yas30_ch10c=7 then resdebt=1000001;
if yhou_ch1 in (-1 -2 -3) or yas30_ch9 in (-1 -2 -3) or yas30_ch10c in (-1 -2 -3) then resdebt=-3;

 /***********************liabilities section 3: second mortgage-othmort****************/


/* asset30 adjusted for questions skipped or not in r18 */
yhou_ch8bu = -4;
yhou_ch8bl = -4;

if yhou_dlimortgage=1 or yhou_dliown2=1 or yhou_ch1 in (1 2 3 4 5) then do;
 if yhou_ch8=1 then
 if yhou_ch8_1=1 & yhou_ch8a>=0 then othmort=yhou_ch8a;
 else if yhou_ch8_1=2 & yhou_ch8bu>=0 & yhou_ch8bl>=0 then
 if yhou_ch8bu>=yhou_ch8bl then othmort=(yhou_ch8bu + yhou_ch8bl)/2;
 else othmort=-3;
 if yhou_ch8_1 not in (1,2) or yhou_ch8a in (-1,-2) then
 if 1<=yhou_ch8c<=7 then flag_othmort=2;
 if yhou_ch8c=1 then othmort=12500;
 else if yhou_ch8c=2 then othmort=37500;
 else if yhou_ch8c=3 then othmort=75000;
 else if yhou_ch8c=4 then othmort=175000;
 else if yhou_ch8c=5 then othmort=375000;
 else if yhou_ch8c=6 then othmort=750000;
 else if yhou_ch8c=7 then othmort=1000001;
if yhou_ch1 in (-1 -2 -3) or yhou_ch8 in (-1 -2 -3) or yhou_ch8bl in (-1 -2 -3) or yhou_ch8bu in (-1 -2 -3) or yhou_ch8c in (-1 -2 -3) then othmort=-3;

if yas30_age30elig2 ne 1 then do;

/*************liabilities section 4: car debt-cardebt1*********************************/


/* asset30 adjusted for questions skipped or not in r18 */
yas30_4844l = -4;
yas30_4844u = -4;
yas30_4846 = -4;

if yas30_4790=1 then
 if yas30_4840=1 & yas30_4842>=0 then cardebt1=yas30_4842;
 if yas30_4840=2 and yas30_4844l >=0 and yas30_4844u >=0 then
 if yas30_4844u>= yas30_4844l then cardebt1=(yas30_4844u+ yas30_4844l)/2;
 else cardebt1=-3;
 if yas30_4840 not in (1,2) or yas30_4842 in (-1, -2) then
 if 1 <=yas30_4846<=7 then flag_cardebt1=2;
 if yas30_4846=1 then cardebt1=2500;
 else if yas30_4846=2 then cardebt1=7500;
 else if yas30_4846=3 then cardebt1=17500;
 else if yas30_4846=4 then cardebt1=37500;
 else if yas30_4846=5 then cardebt1=75000;
 else if yas30_4846=6 then cardebt1=175000;
 else if yas30_4846=7 then cardebt1=250001;

if yas30_4790=-1 or yas30_4844l=-1 or yas30_4844u=-1 or yas30_4846=-1 then cardebt1=-1;
 if yas30_4790=-2 or yas30_4844l=-2 or yas30_4844u=-2 or yas30_4846=-2 then cardebt1=-2;
 if yas30_4790=-3 or yas30_4844l=-3 or yas30_4844u=-3 or yas30_4846=-3 or yas30_4842=-3 then cardebt1=-3;

 liabilities section 4.2: secondary info source for car debt --cardebt2

/* asset30 adjusted for questions skipped or not in r18 */
yas30_4000s10bl = -4;
yas30_4000s10bu = -4;
yas30_4000s10c = -4;


if yas30_4000s8 =1 then
 if yas30_4000s10 =1 and yas30_4000s10a>=0 then cardebt2= yas30_4000s10a;
 else if yas30_4000s10 = 2 and yas30_4000s10bl>=0 and yas30_4000s10bu>=0 then
 if yas30_4000s10bu>= yas30_4000s10bl then cardebt2=(yas30_4000s10bu+yas30_4000s10bl)/2;
 else cardebt2=-3;
 if yas30_4000s10 not in (1,2) or yas30_4000s10a in (-1,-2) then
 if 1<= yas30_4000s10c <=8 then flag_cardebt2=2;
 if yas30_4000s10c=1 then cardebt2= 500;
 else if yas30_4000s10c=2 then cardebt2= 1750;
 else if yas30_4000s10c=3 then cardebt2= 3750;
 else if yas30_4000s10c=4 then cardebt2= 7500;
 else if yas30_4000s10c=5 then cardebt2= 17500;
 else if yas30_4000s10c=6 then cardebt2= 37500;
 else if yas30_4000s10c=7 then cardebt2= 75000;
 else if yas30_4000s10c=8 then cardebt2= 100001;

if yas30_4000s8=-1 or yas30_4000s10bl=-1 or yas30_4000s10bu=-1 or yas30_4000s10c=-1 then cardebt2=-1;
if yas30_4000s8=-2 or yas30_4000s10bl=-2 or yas30_4000s10bu=-2 or yas30_4000s10c=-2 then cardebt2=-2;
if yas30_4000s8=-3 or yas30_4000s10bl=-3 or yas30_4000s10bu=-3 or yas30_4000s10c=-3 then cardebt2=-3;

 /*********************liabilities section 5: personal education loan-famedudebt****************/


/* asset30 adjusted for questions skipped or not in r18 */
yas30_5013l = -4;
yas30_5013u = -4;

if yas30_5011=1 then
 if yas30_5011a=1 & yas30_5012>=0 then famedudebt=yas30_5012;
 else if yas30_5011a=2 & yas30_5013l>=0 & yas30_5013u>=0 then
 if yas30_5013u>=yas30_5013l then famedudebt=(yas30_5013l+yas30_5013u)/2;
 else famedudebt=-3;
 if yas30_5011a not in (1,2) or yas30_5012 in (-1,-2) then
 if 1<=yas30_5014<=8 then flag_famedudebt=2;
 if yas30_5014=1 then famedudebt=500;
 else if yas30_5014=2 then famedudebt=1750;
 else if yas30_5014=3 then famedudebt=3750;
 else if yas30_5014=4 then famedudebt=7500;
 else if yas30_5014=5 then famedudebt=17500;
 else if yas30_5014=6 then famedudebt=37500;
 else if yas30_5014=7 then famedudebt=75000;
 else if yas30_5014=8 then famedudebt=100001;

if yas30_5011=-1 or yas30_5013u=-1 or yas30_5013l=-1 or yas30_5014=-1 then famedudebt=-1;
if yas30_5011=-2 or yas30_5013u=-2 or yas30_5013l=-2 or yas30_5014=-2 then famedudebt=-2;
if yas30_5011=-3 or yas30_5013u=-3 or yas30_5013l=-3 or yas30_5014=-3 or yas30_5012=-3 then famedudebt=-3;

if yas30_age30elig2=1 & famedudebt=-4 & famedudebt_c ne 0 then do;

 /****************liabilities section 6: government education loan-govdebt***************/


/* asset30 adjusted for questions skipped or not in r18 */
yas30_5017u = -4;
yas30_5017l = -4;

if yas30_5015=1 then
 if yas30_5015a=1 & yas30_5016>=0 then govdebt=yas30_5016;
 else if yas30_5015a=2 & yas30_5017u>=0 & yas30_5017l>=0 then
 if yas30_5017u>=yas30_5017l then govdebt=(yas30_5017u + yas30_5017l)/2;
 else govdebt=-3;
 if yas30_5015a not in (1,2) or yas30_5016 in (-1,-2) then
 if 1<=yas30_5018<=8 then flag_govdebt=2;
 if yas30_5018=1 then govdebt=500;
 else if yas30_5018=2 then govdebt =1750;
 else if yas30_5018=3 then govdebt=3750;
 else if yas30_5018=4 then govdebt=7500;
 else if yas30_5018=5 then govdebt=17500;
 else if yas30_5018=6 then govdebt=37500;
 else if yas30_5018=7 then govdebt=75000;
 else if yas30_5018=8 then govdebt=100001;

if yas30_5015=-1 or yas30_5017u=-1 or yas30_5017l=-1 or yas30_5018=-1 then govdebt=-1;
if yas30_5015=-2 or yas30_5017u=-2 or yas30_5017l=-2 or yas30_5018=-2 then govdebt=-2;
if yas30_5015=-3 or yas30_5017u=-3 or yas30_5017l=-3 or yas30_5018=-3 or yas30_5016=-3 then govdebt=-3;

if yas30_age30elig2=1 & govdebt=-4 & govdebt_c ne 0 then do;

   /****************liabilities30 section 6a:  spouse-partner education loan***************/


if yas30_5040_new=1 then



        if yas30_5074_new=1 & yas30_5082_new>=0 then sparedudebt=yas30_5082_new;

        else if yas30_5074_new=2 & yas30_5084_newu>=0 & yas30_5084_newl>=0 then


               if yas30_5084_newu>=yas30_5084_newl then sparedudebt=(yas30_5084_newu + yas30_5084_newl)/2;

               else sparedudebt=-3;


        if yas30_5074_new not in (1,2) or yas30_5082_new in (-1,-2) then


               if 1<=yas30_5086_new<=8 then flag_sparedudebt=2;

               if yas30_5086_new=1 then sparedudebt=2500;

               else if yas30_5086_new=2 then sparedudebt=7500; 

               else if yas30_5086_new=3 then sparedudebt=17500;

               else if yas30_5086_new=4 then sparedudebt=37500;

               else if yas30_5086_new=5 then sparedudebt=75000;

               else if yas30_5086_new=6 then sparedudebt=175000;

               else if yas30_5086_new=7 then sparedudebt=250001;



if yas30_5040_new=-1 or yas30_5084_newu=-1 or yas30_5084_newl=-1 or yas30_5086_new=-1 then sparedudebt=-3;

if yas30_5040_new=-2 or yas30_5084_newu=-2 or yas30_5084_newl=-2 or yas30_5086_new=-2 then sparedudebt=-3;

if yas30_5040_new=-3 or yas30_5084_newu=-3 or yas30_5084_newl=-3 or yas30_5086_new=-3 or yas30_5082_new=-3 then sparedudebt=-3;

if yas30_age30elig2=1 & sparedudebt > 0 then do;



 /**********************liabilities section 7: other debt to family or relatives--famdebt***********/

/* asset30 adjusted for questions skipped or not in r18 */
yas30_5174l = -4;
yas30_5174u = -4;
yas30_5176 = -4;

 if yas30_5130=1 then
 if yas30_5170=1 & yas30_5172>=0 then famdebt=yas30_5172;
 else if yas30_5170=2 & yas30_5174l>=0 & yas30_5174u>=0 then
 if yas30_5174u>=yas30_5174l then famdebt = (yas30_5174u+yas30_5174l)/2;
 else famdebt=-3;
 if yas30_5170 not in (1,2) or yas30_5172 in (-1, -2) then
 if 1<=yas30_5176<=9 then flag_famdebt=2;
 if yas30_5176=1 then famdebt=500;
 else if yas30_5176=2 then famdebt=1750;
 else if yas30_5176=3 then famdebt=3750;
 else if yas30_5176=4 then famdebt=7500;
 else if yas30_5176=5 then famdebt=17500;
 else if yas30_5176=6 then famdebt=37500;
 else if yas30_5176=7 then famdebt=75000;
 else if yas30_5176=8 then famdebt=175000;
 else if yas30_5176=9 then famdebt=250001;
 if yas30_5130=-1 or yas30_5176=-1 or yas30_5174l=-1 or yas30_5174u=-1 then famdebt=-1;
 if yas30_5130=-2 or yas30_5176=-2 or yas30_5174l=-2 or yas30_5174u=-2 then famdebt=-2;
 if yas30_5130=-3 or yas30_5176=-3 or yas30_5174l=-3 or yas30_5174u=-3 or yas30_5172=-3 then famdebt=-3;

 /*************************liabilities section 8: other debt--othdebt**************/

/* asset30 adjusted for questions skipped or not in r18 */
yas30_5210c3u = -4;
yas30_5210c3l = -4;
yas30_5210a3u = -4;
yas30_5210a3l = -4;
yas30_5210c4 = -4;
yas30_5210d3l = -4;
yas30_5210d3u = -4;
yas30_5210d4 = -4;


if yas30_5210aa=0 | yas30_5210aa = -4 then
 if yas30_5210a1=1 & yas30_5210a2>=0 then othdebt1=yas30_5210a2;
 else if yas30_5210a1=2 & yas30_5210a3u>=0 & yas30_5210a3l>=0 then
 if yas30_5210a3u>=yas30_5210a3l then othdebt1= (yas30_5210a3u + yas30_5210a3l)/2;
 else othdebt1=-3;
 if yas30_5210a1 not in (1,2) or yas30_5210a2 in (-1,-2) then
 if 1<=yas30_5210a4<=8 then flag_othdebt1=2;
 if yas30_5210a4=1 then othdebt1=500;
 else if yas30_5210a4=2 then othdebt1=1750;
 else if yas30_5210a4=3 then othdebt1=3750;
 else if yas30_5210a4=4 then othdebt1=7500;
 else if yas30_5210a4=5 then othdebt1=17500;
 else if yas30_5210a4=6 then othdebt1=37500;
 else if yas30_5210a4=7 then othdebt1=75000;
 else if yas30_5210a4=8 then othdebt1=100001;
if yas30_5210a =-1 or yas30_5210aa=-1 or yas30_5210a3u=-1 or yas30_5210a3l=-1 or yas30_5210a4=-1 then othdebt1=-1;
if yas30_5210a =-2 or yas30_5210aa=-2 or yas30_5210a3u=-2 or yas30_5210a3l=-2 or yas30_5210a4=-2 then othdebt1=-2;
if yas30_5210a =-3 or yas30_5210aa=-3 or yas30_5210a3u=-3 or yas30_5210a3l=-3 or yas30_5210a4=-3 or yas30_5210a2=-3 then othdebt1=-3;

if yas30_5210b1=1 then
 if yas30_5210c1=1 & yas30_5210c2>=0 then othdebt2=yas30_5210c2;
 else if yas30_5210c1=2 & yas30_5210c3u>=0 & yas30_5210c3l>=0 then
 if yas30_5210c3u>=yas30_5210c3l then othdebt2= (yas30_5210c3u + yas30_5210c3l)/2;
 else othdebt2=-3;
 if yas30_5210c1 not in (1,2) or yas30_5210c2 in (-1, -2) then
 if 1<=yas30_5210c4<=7 then flag_othdebt2=2;
 if yas30_5210c4=1 then othdebt2=500;
 else if yas30_5210c4=2 then othdebt2=1750;
 else if yas30_5210c4=3 then othdebt2=3750;
 else if yas30_5210c4=4 then othdebt2=7500;
 else if yas30_5210c4=5 then othdebt2=17500;
 else if yas30_5210c4=6 then othdebt2=37500;
 else if yas30_5210c4=7 then othdebt2=50001;
if yas30_5210b1=-1 or yas30_5210c3u=-1 or yas30_5210c3l=-1 or yas30_5210c4=-1 then othdebt2=-1;
if yas30_5210b1=-2 or yas30_5210c3u=-2 or yas30_5210c3l=-2 or yas30_5210c4=-2 then othdebt2=-1;
if yas30_5210b1=-3 or yas30_5210c3u=-3 or yas30_5210c3l=-3 or yas30_5210c4=-3 or yas30_5210c2=-3 then othdebt2=-3;

if yas30_5210d1=1 then
 if yas30_5210d1a=1 & yas30_5210d2>=0 then othdebt3=yas30_5210d2;
 else if yas30_5210d1a=2 & yas30_5210d3l>=0 & yas30_5210d3u>=0 then
 if yas30_5210d3u>=yas30_5210d3l then othdebt3 = (yas30_5210d3l+yas30_5210d3u)/2;
 else othdebt3=-3;
 if yas30_5210d1a not in (1,2) or yas30_5210d2 in (-1,-2) then
 if 1<=yas30_5210d4<=7 then flag_othdebt3=2;
 if yas30_5210d4=1 then othdebt3=500;
 else if yas30_5210d4=2 then othdebt3=1750;
 else if yas30_5210d4=3 then othdebt3=3750;
 else if yas30_5210d4=4 then othdebt3=7500;
 else if yas30_5210d4=5 then othdebt3=17500;
 else if yas30_5210d4=6 then othdebt3=37500;
 else if yas30_5210d4=7 then othdebt3=50001;
if yas30_5210d1=-1 or yas30_5210d3l=-1 or yas30_5210d3u=-1 or yas30_5210d4=-1 then othdebt3=-1;
if yas30_5210d1=-2 or yas30_5210d3l=-2 or yas30_5210d3u=-2 or yas30_5210d4=-2 then othdebt3=-2;
if yas30_5210d1=-3 or yas30_5210d3l=-3 or yas30_5210d3u=-3 or yas30_5210d4=-3 or yas30_5210d2=-3 then othdebt3=-3;

 end of data cleaning for liabilities and assets
 begin calculations:

array varsasst (*) house_value pvbuss_01-pvbuss_04 othreal ira_01-ira_07
 retdsav banksav bonds stocks pvcars1 pvcars2 pvfurn othsav loans;

array varsliab (*) mortgag resdebt othmort cardebt1 cardebt2 famedudebt govdebt sparedudebt othdebt1 othdebt2 othdebt3

array flgsasst (*) flag_house
 flag_pvbuss flag_othreal flag_ira flag_retdsav flag_banksav flag_bonds
 flag_stocks flag_pvcars1 flag_pvcars2 flag_pvfurn flag_othsav flag_loans;

array flgsliab (*) flag_mortgag flag_resdebt flag_othmort flag_cardebt1 flag_cardebt2
 flag_famedudebt flag_govdebt flag_sparedudebt flag_othdebt1 flag_othdebt2 flag_othdebt3 flag_famdebt;

array ahousedebt (*) mortgag resdebt othmort;

array afinance (*) ira_01-ira_07 retdsav banksav bonds stocks othsav loans;

array anonfinance (*) pvbuss_01-pvbuss_04 othreal pvcars1 pvcars2 pvfurn;

array adebt (*) cardebt1 cardebt2 famedudebt govdebt sparedudebt othdebt1 othdebt2 othdebt3 famdebt;

array flgshsdt(*) flag_mortgag flag_resdebt flag_othmort;

array flgsfin(*) flag_ira flag_retdsav flag_banksav flag_bonds flag_stocks flag_othsav flag_loans;

array flgsnonfin(*) flag_pvbuss flag_othreal flag_pvcars1 flag_pvcars2 flag_pvfurn;

array flgsdebt(*) flag_cardebt1 flag_cardebt2 flag_famedudebt flag_govdebt flag_sparedudebt flag_othdebt1 flag_othdebt2 flag_othdebt3


if yas30_age30elig2=1 then

hhworthy=0; assets=0; housedebt=0; liabilities=0; finance=0; nonfinance=0; debt=0;
 do i=1 to dim(varsasst);
 if varsasst(i) not in (-1,-2,-3,-4,-5) then assets=assets+varsasst(i);
 if varsasst(i) in (-1,-2,-3) then flagsasst=-3;
 do i=1 to dim(varsliab);
 if varsliab(i) not in (-1,-2,-3,-4,-5) then liabilities=liabilities+varsliab(i);
 if varsliab(i) in (-1,-2,-3) then flagsliab=-3;


do i=1 to dim(ahousedebt);
 if ahousedebt(i) not in (-1,-2,-3,-4,-5) then housedebt=housedebt+ahousedebt(i);
 if ahousedebt(i) in (-1,-2,-3) then flagshsdt=-3;
 do i=1 to dim(afinance);
 if afinance(i) not in (-1,-2,-3,-4,-5) then finance=finance+afinance(i);
 if afinance(i) in (-1,-2,-3) then flagsfin=-3;
 do i=1 to dim(anonfinance);
 if anonfinance(i) not in (-1,-2,-3,-4,-5) then nonfinance=nonfinance+anonfinance(i);
 if anonfinance(i) in (-1,-2,-3) then flagsnonfin=-3;
 do i=1 to dim(adebt);
 if adebt(i) not in (-1,-2,-3,-4,-5) then debt=debt+adebt(i);
 if adebt(i) in (-1,-2,-3) then flagsdebt=-3;


/*** code hhworthy as an invalid skip for those who did not give valid responses */
do i=1 to dim(varsasst);
 if varsasst(i)=-1 then

do i=1 to dim(varsliab);
 if varsliab(i)=-1 then

do i=1 to dim(varsasst);
 if varsasst(i)=-2 then

do i=1 to dim(varsliab);
 if varsliab(i)=-2 then

do i=1 to dim(varsasst);
 if varsasst(i)=-3 then

do i=1 to dim(varsliab);
 if varsliab(i)=-3 then

do i=1 to dim(ahousedebt);
 if ahousedebt(i)=-1 then housedebt=-1;
 else if ahousedebt(i)=-2 then housedebt=-2;
 else if ahousedebt(i)=-3 then housedebt=-3;

do i=1 to dim(afinance);
 if afinance(i)=-1 then finance=-1;
 else if afinance(i)=-2 then finance=-2;
 else if afinance(i)=-3 then finance=-3;

do i=1 to dim(anonfinance);
 if anonfinance(i)=-1 then nonfinance=-1;
 else if anonfinance(i)=-2 then nonfinance=-2;
 else if anonfinance(i)=-3 then nonfinance=-3;

do i=1 to dim(adebt);
 if adebt(i)=-1 then debt=-1;
 else if adebt(i)=-2 then debt=-2;
 else if adebt(i)=-3 then debt=-3;


/** change all the -1s, -2s to -3s. **/

array finalv(*) hhworthy assets liabilities housedebt house_value finance nonfinance debt;
do i=1 to dim(finalv);
 if finalv(i) in (-1,-2) then finalv(i)=-3;

***** current round vs CVC;

array cvprevrd(7)
 cvc_hh_net_worth_30 cvc_house_value_30 cvc_house_debt_30 cvc_house_type_30
 cvc_assets_financial_30 cvc_assets_nonfinancial_30 cvc_assets_debts_30;
 do i=1 to dim(cvprevrd);
 if cvprevrd(i) ~=-4 then cvpreval=1;

array curr(7)
 hhworthy house_value housedebt housing_type finance
 nonfinance debt ;
 do i=1 to dim(curr);
 if curr(i) not in (-4,-5,.) then currval=1;

assetrd_cvc=-4 ;
 array cvc(7)
 hhworthy_cvc house_value_cvc housedebt_cvc housing_type_cvc
 finance_cvc nonfinance_cvc debt_cvc ;

do i = 1 to dim(cvc);

* curr vs cvc from the prev round;
 if cvpreval =1 & cvc_assets_rnd_30 not in (14 15 16 17) then flag1=1;
 if cvpreval =1 & currval=1 then flag2=1;
 if currval=1 & cvc_assets_rnd_30 in (14 15 16 17) then flag3=1;

if cvpreval =1 & cvc_assets_rnd_30 in (14 15 16 17) & currval~=1 then do i = 1 to 7 ;
 assetrd_cvc= cvc_assets_rnd_30;
 if cvpreval ~=1 & cvc_assets_rnd_30 not in (14 15 16 17) & currval=1 then do i = 1 to 7 ;

/* top coding. (there is no bottom coding.) */

if hhworthy_cvc ge 600000 then hhworthy_cvc=600000;
 if house_value_cvc ge 425000 then house_value_cvc=425000;
 if housedebt_cvc ge 325000 then housedebt_cvc=325000;
 if finance_cvc ge 300000 then finance_cvc=300000;
 if nonfinance_cvc ge 600000 then nonfinance_cvc=600000;
 if debt_cvc ge 370000 then debt_cvc=370000;