options ls=72 ps=72; data cholst; infile "cholst.dat"; input newid id cholst sex age year; if cholst=. then delete; run; proc sort; by newid year; run; proc print data=cholst (obs=20); var newid cholst sex age year; run; title "First stage in two-stage analysis"; proc reg outest=out noprint; model cholst = year; by newid; run; data out; set out; b0 = intercept; b1 = year; keep newid b0 b1; run; data main; merge cholst out; by newid; if first.newid=1; run; title "Summary statististics for intercepts and slopes"; proc means mean stderr t probt; var b0 b1; run; title "Correlation between intercepts and slopes"; proc corr; var b0 b1; run; title "Test equality of variances of intercepts and slopes between sexes"; proc ttest; class sex; var b0 b1; run; title "Regression to look at the association between intercept and age, sex"; proc reg data=main; model b0 = age sex; run; title "Regression to look at the association between slope and age, sex"; proc reg data=main; model b1 = age sex; run;