Recursive partitioning analysis or CART analysis with suvival data

Posts: 1

Recursive partitioning analysis or CART analysis with suvival data

I am a beginner SAS user with the following problem:


I am trying to determine the time interval after which treatment outcomes worsen.  My variable of interest is survival data (2 components, 1: time to last follow up, 2. status at last follow up (alive=censored, dead = event).  My understanding is that proc HPSPLIT will not work for this type of analysis.  So I am trying to write a macro as follows:    



/* The original Variables: TimeToTreatment is numeric */

/*Initial Part of MACRO creates a Grouping variable depending on the value of the TimeToTreatment */

%MACRO KM_MACRO(DaysTo, WeekNo, DataTable);          /*uses the grouping variable that is passed to the macro as the strata variable */

data Temp_KM ;    /*To keep things simpler for now, only looking at code for recto-sigmoid */

set &DataTable;

%if &DaysTo = . 

%then Group_var = .;


%if (&DaysTo * 1)  lt (&WeekNo*7)       /*Daysto*1 converts string into number,  &weekNo*7 converts weeks to days */

%then Group_var = 1;     /* sets group to shorter delay*/

%else Group_var = 2;/*Sets group to longer delay*/




/*Runs proc LIFETEST for the log - rank test and survival plot using the Grouping variable to define the two strata */

proc LIFETEST data=Temp_KM  plots=(Survival)  NOTABLE;

time Survival_Time * STATUS(1);  /*Survival Time and Status are both in the dataset that is passed to the MACRO*/

strata Group_var / order=internal test=logrank; /*Uses the passed Grouping variable as the strata identification.  */





data working;

set Disease_Site;

do i = 7 to 15;                   /*Counter for number of weeks; looking for best break point between 7 to 15 weeks*/

call execute %KM_MACRO(DaysTo=TimeToTreatment, WeekNo=i, DataTable=Working); /*TimeToTreatment is in the Disease+_Site dataset*/

end;   /* Ends do loop */



However, when I run this macro, I get the following error: 

ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required.


Is there a way to fix this error,  also is this the best approach for doing repeated log-rank analysis for survival data (with both survival time and status values) at different cutoff points.  Can survival data be used with HPSPLIT or another function that will do recursive partitioning analysis.  The ultimate goal is to look at p-values but also look at the median and mean survival times to select the best break point.


Thank you for your help.


Super User
Posts: 23,776

Re: Recursive partitioning analysis or CART analysis with suvival data

Call execute expects a string. 


Something of the sort:


Call execute('%macroname(......);');
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation