LIBNAME NLSYa 'C:\Users\ProfessorKate\Desktop\K-State PhD Program\Heckman RC\NLSY\NLSY for Heckman RC';
DATA nlsyproject;
MERGE NLSYa.famses NLSYa.crimepercep NLSYa.otherincome;
BY ID;
*Gender;
Gender=R0536300;
if 0<Gender<3;
if gender=1 then male=1; else male=0;
if gender=2 then female=1; else female=0;
*Race;
Race=R1482600;
if 0<Race<5;
if race=1 then hispanic=1; else hispanic=0;
if race=2 then black=1; else black=0;
if race=3 then other=1; else other=0;
if race=4 then white=1; else white=0;
*HH receive welfare income?;
if R0611300 not in (.R, .D, .V, .I, .N) THEN DO;
Welfare=R0611300; WelfareMiss=0;
if Welfare=1 then welfareyes=1; else welfareyes=0;
if Welfare=0 then welfareno=1; else welfareno=0;
end;
if R0611300 in (.R, .D, .V, .I, .N) THEN DO;
Welfare=R0611300; WelfareMiss=1;
end;
/*Total Welfare income received (annual);
if R0611400 not in (.R, .D, .V, .I, .N) THEN DO;
TotalWelfare=R0611400; TotalWelfareMiss=0;
if TotalWelfare<500 then LT500=1; else LT500=0;
if 500<=TotalWelfare<1000 then BT500_1k=1; else BT500_1k=0;
if 1000<=TotalWelfare<1500 then BT1k_1500=1; else BT1k_1500=0;
if 1500<=TotalWelfare<2000 then BT1500_2k=1; else BT1500_2k=0;
if 2000<=TotalWelfare<2500 then BT2k_2500=1; else BT2k_2500=0;
if 2500<=TotalWelfare<3000 then BT2500_3k=1; else BT2500_3k=0;
if 3000<=TotalWelfare<3500 then BT3k_3500=1; else BT3k_3500=0;
if 3500<=TotalWelfare<4000 then BT3500_4k=1; else BT3500_4k=0;
if 4000<=TotalWelfare<4500 then BT4k_4500=1; else BT4k_4500=0;
if 4500<=TotalWelfare<5000 then BT4500_5k=1; else BT4500_5k=0;
if 5000<=TotalWelfare<7000 then BT5k_7k=1; else BT5k_7k=0;
if 7000<=TotalWelfare<10000 then BT7k_10k=1; else BT7k_10k=0;
if 10000<=TotalWelfare then TenKplus=1; else TenKplus=0;
end;
if R0611400 in (.R, .D, .V, .I, .N) THEN DO;
TotalWelfare=R0611300; TotalWelfareMiss=1;
end;
*/
*HH receive SSI?;
if R0611900 not in (.R, .D, .V, .I, .N) THEN DO;
SSI=R0611900; SSIMiss=0;
if SSI=1 then SSIyes=1; else SSIyes=0;
if SSI=0 then SSIno=1; else SSIno=0;
end;
if R0611900 in (.R, .D, .V, .I, .N) THEN DO;
SSI=R0611900; SSIMiss=1;
end;
/*Total SSI received (annual);
if R0611200 not in (.R, .D, .V, .I, .N) THEN DO;
RecSSI=R061200; RecSSIMiss=0;
if SSI<500 then SSLT500=1; else SSILT500=0;
if 500<=RecSSI<1000 then SSIBT500_1k=1; else SSIBT500_1k=0;
if 1000<=RecSSI<1500 then SSIBT1k_1500=1; else SSIBT1k_1500=0;
if 1500<=RecSSI<2000 then SSIBT1500_2k=1; else SSIBT1500_2k=0;
if 2000<=RecSSI<2500 then SSIBT2k_2500=1; else SSIBT2k_2500=0;
if 2500<=RecSSI<3000 then SSIBT2500_3k=1; else SSIBT2500_3k=0;
if 3000<=RecSSI<3500 then SSIBT3k_3500=1; else SSIBT3k_3500=0;
if 3500<=RecSSI<4000 then SSIBT3500_4k=1; else SSIBT3500_4k=0;
if 4000<=RecSSI<4500 then SSIBT4k_4500=1; else SSIBT4k_4500=0;
if 4500<=RecSSI<5000 then SSIBT4500_5k=1; else SSIBT4500_5k=0;
if 5000<=RecSSI<7000 then SSIBT5k_7k=1; else SSIBT5k_7k=0;
if 7000<=RecSSI<10000 then SSIBT7k_10k=1; else SSIBT7k_10k=0;
if 10000<=RecSSI<20000 then SSIBT10k_20k=1; else SSIBT10k_20k=0;
if 20000<=recSSI<50000 then SSIBT20k_50k=1; else SSIBT20k_50k=0;
end;
if R061200 in (.R, .D, .V, .I, .N) THEN DO;
RecSSI=R061200; SSIMiss=1;
end;
*/
*HH receive food stamps?;
if R0611600 not in (.R, .D, .V, .I, .N) THEN DO;
FoodStamps=R0611600; FoodStampsMiss=0;
if FoodStamps=1 then FSyes=1; else FSyes=0;
if FoodStamps=0 then FSno=1; else FSno=0;
end;
IF R0611600 in (.R, .D, .V, .I, .N) THEN DO;
FoodStamps=R0611600; FoodStampsMiss=1;
end;
/*Total Food Stamps received (annual);
if R0611700 not in (.R, .D, .V, .I, .N) THEN DO;
TotalFS=R0611700; TotalFSMiss=0;
if 0<=TotalFS<500 then LT500FS=1; else LT500FS=0;
if 500<=Totalfs<1000 then BT500_1kFS=1; else BT500_1kFS=0;
if 1000<=Totalfs<1500 then BT1k_1500FS=1; else BT1k_1500FS=0;
if 1500<=Totalfs<2000 then BT1500_2kFS=1; else BT1500_2kFS=0;
if 2000<=Totalfs<2500 then BT2k_2500FS=1; else BT2k_2500FS=0;
if 2500<=Totalfs<3000 then BT2500_3kFS=1; else BT2500_3kFS=0;
if 3000<=Totalfs<3500 then BT3k_3500FS=1; else BT3k_3500FS=0;
if 3500<=Totalfs<4000 then BT3500_4kFS=1; else BT3500_4kFS=0;
if 4000<=Totalfs<4500 then BT4k_4500FS=1; else BT4k_4500FS=0;
if 4500<=Totalfs<5000 then BT4500_5kFS=1; else BT4500_5kFS=0;
if 5000<=Totalfs<7000 then BT5k_7kFS=1; else BT5k_7kFS=0;
if 7000<=TotalFS then SevenKplusFS=1; else SevenKplusFS=0;
end;
IF R0611700 in (.R, .D, .V, .I, .N) THEN DO;
TotalFS=R0611700; TotalFSMiss=1;
end;
*HH entitled to to child support?;
if R0612300 not in (.R, .D, .V, .I, .N) then do;
childsup=R0612300; childsupmiss=0;
if childsup=1 then csyes=1; else csyes=0;
if childsup=0 then csno=1; else csno=0;
end;
if R0612300 in (.R, .D, .V, .I, .N) then do;
childsup=R0612300; childsupmiss=1;
end;
*Total Child Support Received (annual);
if R0612400 not in (.R, .D, .V, .I, .N) THEN DO;
TotalCS=R0612400; TotalCSMiss=0;
if 0<=TotalCS<1000 then LT1KCS=1; else LT1KFS=0;
if 1000<=Totalcs<2000 then BT1k_2kCS=1; else BT1k_2kCS=0;
if 2000<=Totalcs<3000 then BT2k_3kCS=1; else BT2k_3kCS=0;
if 3000<=Totalcs<4000 then BT3k_4kCS=1; else BT3k_4kCS=0;
if 4000<=Totalcs<5000 then BT4k_5kCS=1; else BT4k_5kCS=0;
if 5000<=Totalcs<6000 then BT5k_6kCS=1; else BT5k_6kCS=0;
if 6000<=Totalcs<7000 then BT6k_7kCS=1; else BT6k_7kCS=0;
if 7000<=Totalcs<8000 then BT7k_8kCS=1; else BT7k_8kCS=0;
if 8000<=Totalcs<9000 then BT8k_9kCS=1; else BT8k_9kCS=0;
if 9000<=Totalcs<10000 then BT9k_10kCS=1; else BT9_10kCS=0;
if 10000<=Totalcs<15000 then BT10k_15kCS=1; else BT10k_15kCS=0;
if 15000<=TotalCS then GTE15KplusCS=1; else GTE15KplusCS=0;
end;
IF R0612400 in (.R, .D, .V, .I, .N) THEN DO;
TotalCS=R0612400; TotalCSMiss=1;
end;
*Mobile Home;
*NEED TO COMBINE 1-3 FOR SES/OWNERSHIP/RENTING PORTION OF SES VARIABLE);
IF R0617200 not in (.R, .D, .V, .I, .N) THEN DO;
Mobilehome=R0617200; MHMiss=0;
if MobileHome=1 then ownhomeandlot=1; else ownhomeandlot=0;
if MobileHome=2 then ownhome=1; else ownhome=0;
if MobileHome=3 then ownlot=1; else ownlot=0;
if MobileHome=4 then rentsMH=1; else rentsMH=0;
if MobileHome=7 then neitherownorrentMH=1; else neitherownorrentMH=0;
end;
IF R0617200 in (.R, .D, .V, .I, .N) THEN DO;
TotalFS=R0617200; MHMiss=1;
end;
*Apartment/House;
If R0617900 not in (.R, .D, .V, .I, .N) THEN DO;
ApartHouse=R0617900; ApartHouseMiss=0;
if ApartHouse=1 then ownorbuying=1; else ownorbuying=0;
if ApartHouse=2 then AptHouserent=1; else AptHouserent=0;
if ApartHouse=3 then neitherownorrent=1; else neitherownorrent=0;
end;
if R0617900 in (.R, .D, .V, .I, .N) then do;
ApartHouse=R0617900; ApartHouseMiss=1;
end;
*/
*Checking, Savings, Money Market;
if R0620400 not in (.R, .D, .V, .I, .N) THEN DO;
Banked=R0620400; BankedMiss=0;
if Banked=1 then account=1; else account=0;
if Banked=0 then noaccount=1; else noaccount=0;
end;
if R0620400 in (.R, .D, .V, .I, .N) then do;
Banked=R0620400; BankedMiss=1;
end;
/*Average balance of accounts;
if R0620500 not in (.R, .D, .V, .I, .N) THEN DO;
AVGBAL=R0620500; AVGBALmiss=0;
if AVGBAL=0 then NOBAL=1; else NOBAL=0;
if 1<=AVGBAL<5000 then BT1_5kavgbal=1; else BT1_5kavgbal=0;
if 5000<=AVGBAL<10000 then BT5k_10kavgbal=1; else BT5k_10kavgbal=0;
if 10000<=AVGBAL<15000 then BT10k_15kavgbal=1; else BT10k_15kavgbal=0;
if 15000<=AVGBAL<20000 then BT15k_20kavgbal=1; else BT15k_20kavgbal=0;
if 20000<=AVGBAL<=25000 then BT20k_25kavgbal=1; else BT20k_25kavgbal=0;
if 25000<=AVGBAL<=30000 then BT25k_30kavgbal=1; else BT25k_30kavgbal=0;
if 30000<=AVGBAL<=40000 then BT30k_40kavgbal=1; else BT30k_40kavgbal=0;
if 40000<=AVGBAL<=70000 then BT40k_70kavgbal=1; else BT40k_70kavgbal=0;
if 70000<=AVGBAL then GTE70kplus=1; else GTE70kplus=0;
end;
if R0620500 in (.R, .D, .V, .I, .N) THEN DO;
AVGBAL=R0620500; AVGBALmiss=1;
end;
*/
/*Vehicles;
if R0621300 not in (.R, .D, .V, .I, .N) THEN DO;
Vehicle=R0621300; Vehiclemiss=0;
if vehicle=1 then owncar=1; else owncar=0;
if vehicle=0 then noowncar=1; else noowncar=1;
end;
if R0621300 in (.R, .D, .V, .I, .N) THEN DO;
Vehicle=R0621300; Vehiclemiss=1;
end;
*/
*Age of mother when R born;
if R1200200 not in (.R, .D, .V, .I, .N) THEN DO;
AgeofMom=R1200200; AgeofMomMiss=0;
if 9<=AgeofMom<=14 then BabyMom=1; else BabyMom=0;
if 15<=AgeofMom<=19 then TeenMom=1; else TeenMom=0;
if 20<=AgeofMom<=24 then YoungMom=1; else YoungMom=0;
if 25<=AgeofMom<=29 then late20sMom=1; else late20sMom=0;
if 30<=AgeofMom<=34 then early30sMom=1; else early30sMom=0;
if 35<=AgeofMom<=39 then late30sMom=1; else late30sMom=0;
if 40<=AgeofMom then GTE40yrsplusMom=1; else GTE40yrsplusMom=0;
end;
if R1200200 in (.R, .D, .V, .I, .N) THEN DO;
AgeofMom=R1200200; AgeofMomMiss=1;
end;
*Household income;
if R1204500 not in (.R, .D, .V, .I, .N) THEN DO;
HHIncome=R1204500; IncomeMiss=0;
if 0<=HHIincome then noincome=1; else noincome=0;
if 1<=HHIncome<=5000 then LT5k=1; else LT5k=0;
if 5001<=HHINcome<=10000 then Income5_10k=1; else Income5_10k=0;
if 10001<=HHIncome<=20000 then Income10_20k=1; else Income10_20k=0;
if 20001<=HHIncome<=30000 then Income20_30k=1; else Income20_30k=0;
if 30001<=HHIncome<=40000 then Income30_40k=1; else Income30_40k=0;
if 40001<=HHIncome<=50000 then Income40_50k=1; else Income40_50k=0;
if 50001<=HHIncome<=65000 then Income50_65k=1; else Income50_65k=0;
if 65001<=HHIncome<=80000 then Income65_80k=1; else Income65_80k=0;
if 80001<=HHIncome<=100000 then Income80_100k=1; else Income80_100k=0;
if 100001<=HHIncome<=150000 then Income100_150k=1; else Income100_150k=0;
if 150001<=HHIncome then IncomeGTE150kplus=1; else IncomeGTE150kplus=0;
end;
if R1204500 in (.R, .D, .V, .I, .N) THEN DO;
HHIncome=R1204500; IncomeMiss=0;
end;
*Residential Father's Highest Grade Completed (95= ungraded, only 3, so not concerned);
if R1302600 not in (.R, .D, .V, .I, .N) then do;
ResDad=R1302600; DadEducMiss=0;
if ResDad in (1:5) then elementary=1; else elementary=0;
if ResDad in (6:8) then middleschool=1; else middleschool=0;
if ResDad in (9:12) then highschool=1; else highschool=0;
if ResDad in (13:15) then somecollege=1; else somecollege=0;
if ResDad in (16:17) then Bachelors=1; else Bachelors=0;
if ResDad in (18:20) then PostGrad=1; else PostGrad=0;
if ResDad=95 then ResDad=.;
end;
if R1302600 in (.R, .D, .V, .I, .N) then do;
ResDad=R1302600; DadEducMiss=1;
end;
*Residential Mother's Highest Grade Completed (95=ungraded, only 5, so not concerned);
if R1302700 not in (.R, .D, .V, .I, .N) then do;
ResMom=R1302700; MomEducMiss=0;
if ResMom in (1:5) then elementary=1; else elementary=0;
if ResMom in (6:8) then middleschool=1; else middleschool=0;
if ResMom in (9:12) then highschool=1; else highschool=0;
if ResMom in (13:15) then somecollege=1; else somecollege=0;
if ResMom in (16:17) then Bachelors=1; else Bachelors=0;
if ResMom in (18:20) then PostGrad=1; else PostGrad=0;
if ResMom=95 then ResMom=.;
end;
if R1302700 in (.R, .D, .V, .I, .N) then do;
ResMom=R1302700; MomEducMiss=1;
end;
*Highest Residential Parent Education;
if resdad in (1:20) and resmom in (1:20) then do;
if resDad>resMom then highest=resDad; else if resMom>resDad then highest=resMom;
highest=max(resdad, resmom);
if highest in (1:5) then ParEdElem=1; else ParEdElem=0;
if highest in (6:8) then ParEdmiddle=1; else ParEdmiddle=0;
if highest in (9:12) then ParEdHS=1; else ParEdHS=0;
if highest in (13:15) then ParEdSC=1; else ParEdSC=0;
if highest in (16:17) then ParEdBSBA=1; else ParEdBSBA=0;
if highest in (18:20) then ParEdGrad=1; else ParEdGrad=0;
end;
if highest not in (1:20) then do;
if highest=95 then ungraded=1; else ungraded=0;
if highest in (.R, .D, .V, .I, .N) then highestmiss=1; else highestmiss=0;
end;
Proc freq data=famses; where resDad in (1:20) and resMom in (1:20); table highest; run;
... View more