Using SAS 9.4 I am running the following code to format a KM curve:
data _null_;
%let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/151;
infile "http:&url/templft.html" device=url;
file 'macros.tmp';
retain pre 0;
input;
_infile_ = tranwrd(_infile_, '&', '&');
_infile_ = tranwrd(_infile_, '<' , '<');
if index(_infile_, '</pre>') then pre = 0;
if pre then put _infile_;
if index(_infile_, '<pre>') then pre = 1;
run;
%ProvideSurvivalMacros /* variables available. */
%let TitleText0 = "Figure 2: Implant Survival Free of Reoperation for Infection"; /* Change the title. */
%let TitleText1 = &titletext0 " for " STRATUMID;
%let TitleText2 = &titletext0;
%let xOptions = label="Time to Implant Failure (in Months)"
linearopts=(viewmin=0 viewmax=132
tickvaluelist=(0 12 24 36 48 60 72 84 96 108 120 132));
%let GraphOpts = attrpriority=none
DataLinePatterns=(Solid ShortDash);
%CompileSurvivalTemplates /* Compile the templates with */
/* the new title. */
proc lifetest data = have plots=survival(test ATRISK(maxlen=50));
time TT_fail_months *failure2(0) ;
strata INDEX_TYPE_REV ;
label INDEX_TYPE_REV = 'Index Revision Type'
TT_fail_months = 'Time to Implant Failure (in Months)' ;
run;
%ProvideSurvivalMacros /* Optionally restore the default */
/* macros and macro variables. */
proc template; /* Delete the modified templates. */
delete Stat.Lifetest.Graphics.ProductLimitSurvival / store=sasuser.templat;
delete Stat.Lifetest.Graphics.ProductLimitSurvival2 / store=sasuser.templat;
run;
It has previously run and produced the KM curve as specified. I am returning to it a few months later and now it will not run. Any help would be welcomed. Thank you
Below is my log:
204 data _null_;
205 %let url = //support.sas.com/documentation/onlinedoc/stat/ex_code/151;
206 infile "http:&url/templft.html" device=url;
207
208 file 'macros.tmp';
209 retain pre 0;
210 input;
211 _infile_ = tranwrd(_infile_, '&', '&');
212 _infile_ = tranwrd(_infile_, '<' , '<');
213 if index(_infile_, '</pre>') then pre = 0;
214 if pre then put _infile_;
215 if index(_infile_, '<pre>') then pre = 1;
216 run;
NOTE: The infile "http://support.sas.com/documentation/onlinedoc/stat/ex_code/151/templft.html"
is:
Filename=http://support.sas.com/documentation/onlinedoc/stat/ex_code/151/templft.html,
Local Host Name=OCMRCRSLT014,
Local Host IP addr=fe80::f555:3075:e4:7d2c%24,
Service Hostname Name=support.sas.com,
Service IP addr=149.173.160.38,
Service Name=httpd,Service Portno=80,
Lrecl=32767,Recfm=Variable
NOTE: The file 'macros.tmp' is:
Filename=C:\Users\gscar\Desktop\HK073 Unresectable\macros.tmp,
RECFM=V,LRECL=32767,File Size (bytes)=0,
Last Modified=26May2020:13:30:31,
Create Time=21Feb2020:10:30:04
NOTE: 578 records were read from the infile
"http://support.sas.com/documentation/onlinedoc/stat/ex_code/151/templft.html".
The minimum record length was 0.
The maximum record length was 1076.
NOTE: 361 records were written to the file 'macros.tmp'.
The minimum record length was 0.
The maximum record length was 80.
NOTE: DATA statement used (Total process time):
real time 4.74 seconds
cpu time 0.04 seconds
WARNING: Apparent invocation of macro PROVIDESURVIVALMACROS not resolved.
217
218
219 %ProvideSurvivalMacros /* variables available. */
-
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
220
221 %let TitleText0 = "Figure 2: Implant Survival Free of Reoperation for Infection"; /*
221! Change the title. */
222 %let TitleText1 = &titletext0 " for " STRATUMID;
223 %let TitleText2 = &titletext0;
224 %let xOptions = label="Time to Implant Failure (in Months)"
225 linearopts=(viewmin=0 viewmax=132
226 tickvaluelist=(0 12 24 36 48 60 72 84 96 108 120 132));
227 %let GraphOpts = attrpriority=none
228 DataLinePatterns=(Solid ShortDash);
229 %CompileSurvivalTemplates /* Compile the templates with */
WARNING: Apparent invocation of macro COMPILESURVIVALTEMPLATES not resolved.
230 /* the new title. */
231
232 proc lifetest data = have plots=survival(test ATRISK(maxlen=50))
232! ;
233 time TT_fail_months *failure2(0) ;
----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
234 strata INDEX_TYPE_REV ;
------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
235 label INDEX_TYPE_REV = 'Index Revision Type'
-----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
236 TT_fail_months = 'Time to Implant Failure (in Months)' ;
WARNING: Apparent invocation of macro PROVIDESURVIVALMACROS not resolved.
237 run;
238
239 %ProvideSurvivalMacros /* Optionally restore the default */
-
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
240 /* macros and macro variables. */
241
242 proc template;
242! /* Delete the modified templates. */
243 delete Stat.Lifetest.Graphics.ProductLimitSurvival / store=sasuser.templat;
------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
244 delete Stat.Lifetest.Graphics.ProductLimitSurvival2 / store=sasuser.templat;
------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
245 run;
Your data step wrote the macros to a local file. Then you skipped including them. Look at the documentation.
%inc 'macros.tmp' / nosource;
https://support.sas.com/documentation/onlinedoc/stat/151/kaplan.pdf
Your data step wrote the macros to a local file. Then you skipped including them. Look at the documentation.
%inc 'macros.tmp' / nosource;
https://support.sas.com/documentation/onlinedoc/stat/151/kaplan.pdf
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.