I would like to show that the treatment effect vary depending on age, and the relationship is nonlinear. To do so, I would like to conduct statistical analysis and plot which are described in attached article entitled "Statins for primary prevention of cardiovascular events and mortality in old and very old adults with and without type2 diabetes: retrospective cohort study". In this study, statin is useful in younger patients with diabetes mellitus, but not in elderly patients. In Figure 2, x-axis represents age and y-axis represents the hazard ratio for statin use. I tried to create the SAS code for this, but it did not work. ********************************************SAS code*********************************************************** proc phreg data=DATA1; effect SPL = spline(AGE/ degree=2 basis=tpf(noint) details knotmethod=rangefractions(0.25 0.50 0.75) ); class STATIN/param=ref; model MACE_TIME * MACE(0)=SPL AGE AGE*SPL /rl=wald ties=EFRON; store splineout; run; %macro est(ref,start,end,by); %Do i = 1 %To %eval(%SysFunc( Ceil( %SysEvalF( ( &End - &Start ) / &By ) ) ) +1) ; %Let value=%SysEvalF( ( &Start - &By ) + ( &By * &I ) ) ; estimate "&value." SPL &value STATIN [1,1] [-1,0]/ exp cl; %end; %mend est; ods dataset Estimates=Estimates; proc plm restore=splineout; %est(ref=35, start=35, end=100, by=5); run; data estimates; set estimates; AGE=label*1; run; proc sgplot data=estimates ; title "Effect of age" ; Series y=ExpEstimate x=AGE /LINEATTRS=(THICKNESS=3 color=black) ; Series y=LowerExp x=AGE / LINEATTRS=(pattern=ShortDash color=Black THICKNESS=1); Series y=UpperExp x=AGE / LINEATTRS=(pattern=ShortDash color=Black THICKNESS=1); REFLINE 1 / axis=y; yaxis Values=(0 to 5 by 1) Label="Hazard Ratio"; xaxis min=11 VALUES=(35 to 100 by 5) Label="Age" ; run; ********************************************SAS code*********************************************************** I am looking for a way to get an estimate for the hazard ratio for treatment at specific values for age. "https://communities.sas.com/t5/Statistical-Procedures/Estimate-interaction-effect-with-splines/td-p/179802" Sophie post a similar question, and Steve recommended to use "lsmestimate". However, lsmestimate statement cannot be used in PHREG procedure. It is appreciated if you could tell me how to do this. Enzan
... View more