Programming the statistical procedures from SAS

Survival Analysis with 3 Arms

Accepted Solution Solved
Reply
Regular Contributor
Posts: 217
Accepted Solution

Survival Analysis with 3 Arms

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?


Accepted Solutions
Solution
‎01-28-2013 10:31 AM
Grand Advisor
Posts: 16,857

Re: Survival Analysis with 3 Arms

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


All Replies
Solution
‎01-28-2013 10:31 AM
Grand Advisor
Posts: 16,857

Re: Survival Analysis with 3 Arms

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;


Regular Contributor
Posts: 217

Re: Survival Analysis with 3 Arms

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?

Grand Advisor
Posts: 16,857

Re: Survival Analysis with 3 Arms

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.

New Contributor
Posts: 2

Re: Survival Analysis with 3 Arms

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    */

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 250 views
  • 0 likes
  • 3 in conversation