BookmarkSubscribeRSS Feed
OA468
Calcite | Level 5

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 = .;

%else

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

run;

 

 

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

%MEND KM_MACRO;

run;

 

 

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

run;

 

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.

 

1 REPLY 1
Reeza
Super User

Call execute expects a string. 

 

Something of the sort:

 

Call execute('%macroname(......);');

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 539 views
  • 0 likes
  • 2 in conversation