BookmarkSubscribeRSS Feed
Nobuyuki
Calcite | Level 5

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/..."

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

 

 

7 REPLIES 7
Criptic
Lapis Lazuli | Level 10

I'm not sure maybe this is a feature of a newer SAS/STAT Version then you have - but SAS/STAT 15.1 supports it just fine: https://documentation.sas.com/?docsetId=statug&docsetVersion=15.1&docsetTarget=statug_phreg_syntax.h...

Nobuyuki
Calcite | Level 5

Dear Criptic

 

I'm sorry, I did not clarify the problem.

Proc PHREG procedure which I described above work well.

However, I don't know how to estimate the hazard ratio for treatment use at the specific values for age

because I'm not familiar with "estimate" statement.

 

Enzan

StatDave
SAS Super FREQ

Your model looks rather odd - you define STATIN as a CLASS variable but don't use it in the model. And you define a spline on AGE but then use both AGE and its spline in the model. Assuming that STATIN is your treatment variable, I assume what you want in your model is STATIN SPL*STATIN. 

 

I think you can then use the LSMEANS statement with the AT option to do what you are looking for. See the example in this note

Nobuyuki
Calcite | Level 5

I'm sorry, that is wrong code.

 

This is the corrected SAS code.

Also I added lsmeans statement as you recommended.

 

**********************************************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 STATIN STATIN*SPL
/rl=wald ties=EFRON;
store splineout;

lsmeans STATIN / at SPL=50;

run;

 

**********************************************SAS code***********************************************************

 

However, after running this SAS code, caution said

"The model does not have a GLM parameterization. This parameterization is required for the TEST, LSMEANS, LSMESTIMATE, and
SLICE statement. These statements are ignored."

 

I'm using SAS university edition(SAS/STAT version is 15.1).

According to this paper " https://www.pharmasug.org/proceedings/2011/SAS/PharmaSUG-2011-SAS-SP01.pdf ",

"LSMEANS" statement supports the "PHREG" procedure.

 

Could you please tell me how to deal with this?

StatDave
SAS Super FREQ

Just add the PARAM=GLM option following a slash (/) at the end of the CLASS statement so that GLM parameterization is used.

Nobuyuki
Calcite | Level 5

Thank you for your reply.

I understood "param=glm" option and correct SAS code as below.

 

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=glm;
model MACE_TIME * MACE(0)=SPL STATIN STATIN*SPL
/rl=wald ties=EFRON;
store splineout;

lsmeans STATIN "50" /at AGE=50 adjust=tukey cl exp;

lsmestimate STATIN "50" 1 -1 / at AGE=50 e cl exp;

run;

 

 

Does this "lsmeans" estimate calculate hazard ratio for statin use vs. non statin use at age of 50?

Is this correct?

The result obtained from this program was attached (lsmeans_result.tif)

Nobuyuki
Calcite | Level 5

Also I used "lsmestimate".

The results I obtained from this statement was also attached (lsmestimate_result).

 

It seems that something was wrong.

 

Is my SAS program correct code?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1192 views
  • 0 likes
  • 3 in conversation