TITLE "HOMEWORK 6"; OPTIONS nodate PAGENO=1; libname labdata "c:\temp\labdata"; title "Problem 1"; proc freq data=labdata.afifi; tables shoktype inshock shockdum2-shockdum7; run; proc means data=labdata.afifi; class shoktype; var sbp2; run; proc means data=labdata.afifi; class inshock; var sbp2; run; /*Question 2: Box Plots*/ title "Question 2"; proc sort data=labdata.afifi; by shoktype; run; proc boxplot data=labdata.afifi; plot sbp2 * shoktype / boxstyle=schematic; run; proc sort data=labdata.afifi; by inshock; run; proc boxplot data=labdata.afifi; plot sbp2 * inshock / boxstyle=schematic; run; /*Question 3: Regression with Dummy Variables. Level 2 of Shoktype is reference.*/ title "Question 3"; proc reg data=labdata.afifi; model sbp2 = shockdum3 shockdum4 shockdum5 shockdum6 shockdum7; plot residual.*predicted.; output out=outreg1 p=predict r=resid; run; proc univariate data=outreg1 plot normal; var resid; histogram; qqplot / normal(mu=est sigma=est); run;quit; /*Question 4: Regression with Dummy Variables. Level 7 of Shoktype is reference.*/ title "Question 4"; proc reg data=labdata.afifi; model sbp2 = shockdum2 shockdum3 shockdum4 shockdum5 shockdum6; plot residual.*predicted.; output out=outreg1 p=predict r=resid; run; /*Question 5: Regression with Dummy Variables. Non-shock is reference.*/ title "Question 5"; proc reg data=labdata.afifi; model sbp2 = shockdum3 shockdum4 shockdum5 shockdum6 shockdum7 age sbp1 cardiac1; shockdum: test shockdum3=0, shockdum4=0, shockdum5=0, shockdum6=0, shockdum7=0; run; /*Question 6: Regression with INSHOCK, plus continuous covariates as predictors. Non-Shock is reference.*/ title "Question 6"; proc reg data=labdata.afifi; model sbp2 = inshock age sbp1 cardiac1; run;quit; " Age " Sex " Systolic blood pressure at time 1 " Diastolic blood pressure at time 1 " Urinary output at time1 " Heart rate at time1 " Central venous pressure at time 1 " Cardiac output at time 1 " Appearance time at time 1 " Circulation time at time 1 " Plasma level at time 1 " Red cell level at time 1 " Hemoglobin level at time 1 " Hematocrit at time 1 title "Question 7"; proc reg data=labdata.afifi; model map2 = age sex sbp1 dbp1 urine1 heart1 cvp1 cardiac1 apptime1 circ1 plasma1 redcell1 hgb1 hct1 / selection = stepwise; run;quit; title "Question 7"; proc reg data=labdata.afifi; model map2 = age sex sbp1 dbp1 urine1 heart1 cvp1 cardiac1 apptime1 circ1 plasma1 redcell1 hgb1 hct1 / selection = backward; run;quit; proc reg data=labdata.afifi; model map2 = age sex sbp1 dbp1 urine1 heart1 cvp1 cardiac1 apptime1 circ1 plasma1 redcell1 hgb1 hct1 / selection = rsquare best=5 ; run;quit;