turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- how to specify strata specific effects in PHREG?

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-14-2018 02:07 PM

How to i modify the following sample code to get the strata specific effects for a and b? thanks

proc phreg data = abc;

class a b;

model time*event(0) = a b;

strata c d;

run;

Accepted Solutions

Solution

05-16-2018
03:19 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to alexchien

05-15-2018 07:29 AM

Hi Alexchien,

It is important to understand that the strata statement in PHREG means that the baseline hazard function can depend on the variables you put in the strata statement. The variables you put in the model statement will have same effect across the strata variables - unless ofcourse you have also putted the strata variables in the model line.

If you want the effect of A and B to depend of the level of C and D, then you can do as follows:

```
data simulation;
do i=1 to 1000;
A=rand('bernoulli',0.5);
B=rand('bernoulli',0.5);
C=rand('bernoulli',0.5);
D=rand('bernoulli',0.5);
t=rand('exponential',10);
output;
end;
run;
proc phreg data=simulation;
class A B C D/param=glm;
model t=A*C*D B*C*D;
hazardratio A/at(C=all D=all);
hazardratio B/at(C=all D=all);
run;
*or, if you want each strata to has its own baseline hazard function, you should also use the strata statement;
proc phreg data=simulation;
class A B C D/param=glm;
model t=A*C*D B*C*D;
strata C D;
hazardratio A/at(C=all D=all);
hazardratio B/at(C=all D=all);
run;
```

Notice that you need the "glm" parametrization to make the interactions effects that allows you to use C and D as effectmodifiers.

All Replies

Solution

05-16-2018
03:19 PM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to alexchien

05-15-2018 07:29 AM

Hi Alexchien,

It is important to understand that the strata statement in PHREG means that the baseline hazard function can depend on the variables you put in the strata statement. The variables you put in the model statement will have same effect across the strata variables - unless ofcourse you have also putted the strata variables in the model line.

If you want the effect of A and B to depend of the level of C and D, then you can do as follows:

```
data simulation;
do i=1 to 1000;
A=rand('bernoulli',0.5);
B=rand('bernoulli',0.5);
C=rand('bernoulli',0.5);
D=rand('bernoulli',0.5);
t=rand('exponential',10);
output;
end;
run;
proc phreg data=simulation;
class A B C D/param=glm;
model t=A*C*D B*C*D;
hazardratio A/at(C=all D=all);
hazardratio B/at(C=all D=all);
run;
*or, if you want each strata to has its own baseline hazard function, you should also use the strata statement;
proc phreg data=simulation;
class A B C D/param=glm;
model t=A*C*D B*C*D;
strata C D;
hazardratio A/at(C=all D=all);
hazardratio B/at(C=all D=all);
run;
```

Notice that you need the "glm" parametrization to make the interactions effects that allows you to use C and D as effectmodifiers.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to JacobSimonsen

05-16-2018 03:20 PM

thanks for the explanation.