/* * * This is the SAS file for Homework #3 for * 90-771 for Spring, 2005 * * */ options linesize=80; options pagesize=60; %inc "./jackboot.sas"; filename mepsraw 'MEPSextract1996.txt'; data MEPS; infile mepsraw; input age sex income employed insured health spending; income = income/1000; spend0 = spending EQ 0; proc means; /********** Question 1 *****************/ proc reg; model insured = age sex employed income; title "Linear probability model, question 1"; %macro analyze(data=,out=); proc reg data=&data outest=&out noprint; model insured = age sex employed income; %bystmt; run; %mend analyze; run; title "Bootstrap of LPM"; %boot(data=meps,samples=2000,random=717328953); title "Bootstrap CI for employment, percentile method"; %bootci(method=percentile,alpha=0.05,stat=employed); run; title "Bootstrap CI for employment, BCa method"; %bootci(method=bca,alpha=0.05,stat=employed); /********** Question 3 *****************/ proc reg data=meps; model spending = age sex employed income; title "Spending regression, question 3"; /********** Question 4 *****************/ proc qlim data=meps outest=tobit_coef; model spending = age sex employed income / censored(LB=0); output out=tobit_out marginal xbeta; title "Tobit analysis, question 4"; proc print data=tobit_coef; data tobit_coef; set tobit_coef; if _TYPE_ EQ 'STD' then delete; keep _SIGMA; data tobit_out; if _N_ EQ 1 then set tobit_coef; set tobit_out; label Meff_age = " "; label Meff_sex = " "; label Meff_employed = " "; label Meff_income = " "; label Xbeta_spending = " "; XBsig = Xbeta_spending/_SIGMA; P_prob = cdf('normal',XBsig,0,1); proc means data=tobit_out; /********** Question 5 *****************/ data meps; set meps; posspend = spending GT 0; proc qlim data=meps; model posspend = age sex employed insured income / discrete; model spending = age sex income / select(posspend=1); output out=heck_out marginal predicted; title "Heckman analysis, question 5"; data heck_out; set heck_out; label Meff_spending_age = " "; label Meff_spending_sex = " "; label Meff_spending_income = " "; label Meff_P1_posspend_age = " "; label Meff_P2_posspend_age = " "; label Meff_P1_posspend_sex = " "; label Meff_P2_posspend_sex = " "; label Meff_P1_posspend_employed = " "; label Meff_P2_posspend_employed = " "; label Meff_P1_posspend_insured = " "; label Meff_P2_posspend_insured = " "; label Meff_P1_posspend_income = " "; label Meff_P2_posspend_income = " "; label P_posspend = " "; label P_spending = " "; proc means data=heck_out;