Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Estimate hazard ratio for the treatment at specific values for age by ...

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 01-10-2020 07:42 AM
(2392 views)

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.

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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)

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

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.