BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djbateman
Lapis Lazuli | Level 10

I have always done survival analysis with 2 arms: a treatment arm vs. a control arm.  I am now looking at a study with 3 arms: Arm A - treatment alone, Arm B - treatment + SoC (Standard of Care), and Arm C - SoC alone.  I am wondering how to adjust my code to get results for comparing Arm A vs. Arm C and Arm B vs. Arm C.  This is what I use for two arms:

proc phreg data=efficacy;

      model survtime*censorflag(1)=trtarm / ties=exact rl;

run;

How can I adjust this for three arms?  Should I use a WHERE statement and run the procedure twice like this:

proc phreg data=efficacy;

      model survtime*censorflag(1)=trtarm / ties=exact rl;

      where trtarm in ('A','C');

run;

proc phreg data=efficacy;

      model survtime*censorflag(1)=trtarm / ties=exact rl;

      where trtarm in ('B','C');

run;

Or is there a more scientific way?  Maybe using a CLASS statement or a GROUP option somewhere?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

proc phreg data=efficacy;

      model survtime*censorflag(1)=trtarm / ties=exact rl;

run;


You should have had a class variable for trtarm though if it was one and zero it would come out fine. If it was 1/2 I think it would work out differently.


Anyways, you need to add in a class variable, consider it similar to a logistic regression with variable that has multiple levels. OR you could create two indicators variables (1/0) to denote your trtment arms, ie trtarm1 & trtarm2. I think you need param = ref option as well.

proc phreg data=efficacy;

     class trtarm/param=ref;

      model survtime*censorflag(1)=trtarm / ties=exact rl;

     hazardratios trtarm;

run;


View solution in original post

4 REPLIES 4
Reeza
Super User

proc phreg data=efficacy;

      model survtime*censorflag(1)=trtarm / ties=exact rl;

run;


You should have had a class variable for trtarm though if it was one and zero it would come out fine. If it was 1/2 I think it would work out differently.


Anyways, you need to add in a class variable, consider it similar to a logistic regression with variable that has multiple levels. OR you could create two indicators variables (1/0) to denote your trtment arms, ie trtarm1 & trtarm2. I think you need param = ref option as well.

proc phreg data=efficacy;

     class trtarm/param=ref;

      model survtime*censorflag(1)=trtarm / ties=exact rl;

     hazardratios trtarm;

run;


djbateman
Lapis Lazuli | Level 10

I have also been told about creating a "design matrix" where I create two new binary variables.  One is 0 for arm C and 1 for arm A (missing otherwise).  The other is 0 for arm C and 1 for arm B (missing otherwise).  But I don't know where to go from there.  I was told to put it in a group statement, but I cannot find a group statement or group option in the help documentation. Do you know what was being referred to and if that would be a similar approach to the one you just gave?

Reeza
Super User

The design matrix would be creating the two variables I suggested. However the Class statement does that for you. If you look in your output you should even see it printed out. I'm nto sure what they mean by group statement either, doesn't sound familiar.

hbmehta2
Calcite | Level 5

Follow- up question: While using extended Cox model, where exposure is time varying and has more than two arms, how to handle that to get two different HR.


For instance, see below small data and Proc Phreg code. For data tumor01 - exposure is "0" or "1"; so I will get one HR. For data tumor012 - exposure is "0", "1" or "2"; so I should get two HR but I am getting only one HR. I tried to include that in class statement but it gives an error.


SAS CODES:


data Tumor01;                       /*P1 - P15 variable has value of "0" and "1", say drug_A and drug_B*/

   infile datalines missover;

   input ID Time Dead Dose P1-P15;

   label ID='Subject ID';

   datalines;

1 47 1 1.0  0  1 .  1  1 1  1  1 .  .  .  . . . .

2 71 1 1.0  0  . 0  0  0 0  0  0 1  1  1  1 1 1 1

3 81 0 1.0  0  . 1  1  1 1  1  1 1  1  1  1 1 1 1

4 81 0 1.0  0  0 0  0  0 1  1  1 1  1  1  1 1 1 1

5 81 0 1.0  0  0 0  0  0 0  0  0 0  0  0  0 0 0 0

6 65 1 1.0  0  0 0  1  . .  1  1 1  1  1  1 1 . .

7 71 0 4.0  0  0 0  0  0 0  0  0 0  0  0  0 0 0 0

8 69 0 4.0  .  . 0  0  0 0  0  0 0  0  0  0 0 0 0

9 67 1 4.0  .  . 1  1  1 1  1  1 1  1  1  1 1 1 .

10 81 1  4.0 0  0  0 0  0  0 0  0  0 0  0  0 0 0 0

;

run;

           

data Tumor012;                      /*P1 - P15 variable has value of "0", "1" and "2", say drug_A, drug_B and drug_c*/

   infile datalines missover;

   input ID Time Dead Dose P1-P15;

   label ID='Subject ID';

   datalines;

1 47 1 1.0  0  1 .  1  1 1  1  1 .  .  .  . . . .

2 71 1 1.0  0  . 0  0  0 0  0  0 1  1  1  1 1 1 1

3 81 0 1.0  0  . 1  1  1 1  1  1 1  1  1  1 1 1 1

4 81 0 1.0  0  0 0  0  0 2  2  2 2  2  2  2 2 2 2

5 81 0 1.0  0  0 0  0  0 0  0  0 0  0  0  0 0 0 0

6 65 1 1.0  0  0 0  1  . .  1  1 1  1  1  1 1 . .

7 71 0 4.0  0  0 0  0  0 0  0  0 0  0  0  0 0 0 0

8 69 0 4.0  .  . 0  0  0  0  0 0  0  0 0  0 0 0 0

9 67 1 4.0  .  . 1  1  1 1  1  1 1  1  1  1 1 1 .

10 81 1  4.0 0  0  0 0  0  2 2  2  2 2  2  2 2 2 2

;

run;

proc phreg data=Tumor01;            *TRY data = tumor012;

model Time*Dead(0)= NPap / rl;

      array pp{*} P1-P15;

            do i = 1 to 15;

            if pp ne . then do;

      npap = pp ;

      end;

      end;

run;

/* QUESTION: Why I am not getting two hazard ratios for data tumor012

      Shouldn't I get HR for 1 vs 0 and for 2 vs 0    */

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 1735 views
  • 0 likes
  • 3 in conversation