* Solution exercise 3; * Part 1; data wtsbp; infile '~/sasbiostat/2011/data/tomhs.data' termstr=crlf ; input @1 ptid $10 @25 group 1. @27 age 2. @30 sex 1. @47 marital 1. @85 wtbl 5. @91 wt6 5. @115 sbpbl 3. @119 sbp6 3. ; * Part 2; wtdif = wt6 - wtbl; sbpdif = sbp6 - sbpbl; if group = 6 then active=2; else active=1; RUN; PROC MEANS; RUN; * Part 3; PROC FREQ data=wtsbp; TABLES sex; RUN; * 27% of patients were women; * Part 4; PROC MEANS data=wtsbp ; VAR wtbl wt6 sbpbl sbp6 wtdif sbpdif; RUN; * The average weight change was -11.51 ; * Part 5; PROC MEANS data=wtsbp ; CLASS active; VAR wtbl wt6 sbpbl sbp6 wtdif sbpdif; RUN; * The average SBP change in the active group was -15.49 ; * The average SBP change in the placebo group was -12.55 ; PROC TTEST data=wtsbp; CLASS active; VAR sbpdif; RUN; * The change in sbp was not sign between active and placebo groups; * Part 6; PROC SGPLOT data=wtsbp; SCATTER X= wtdif y=sbpdif; TITLE 'Plot of Blood Pressure Versus Weight Change'; RUN; PROC CORR data=wtsbp; VAR wtdif sbpdif; RUN; * The correlation is 0.24775 ; ODS GRAPHICS ON; PROC REG data=wtsbp; MODEL sbpdif = wtdif; RUN; * The regression equation is -11.31610 + -0.30496 * wtdif ; * Part 7; ODS GRAPHICS OFF; PROC UNIVARIATE data=wtsbp; VAR wtdif; RUN; * The 25th, 50th and 75th percentiles of weight change are; * -16.5, -8.4 and -4.5 respectively ; * Part 8; PROC FREQ data=wtsbp; TABLES marital*sex/ CHISQ; RUN; * The percentage of men currently married was 87.67; * The percentage of women that are currently married was 77.78; * The distribution of marital status did not significantly differ ; * between men and women (p=0.4824);