why is it not straightforward to change the axis in a survival plot in proc lifetest?
I have been trying to change the x-axis and it doesn't seem to take...any ideas?
%let xOptions = label="Time to Event (months)"
linearopts=(viewmin=0 viewmax=12
tickvaluelist=(0 2 4 6 8 10 12));
proc lifetest data=Work.Work atrisk plots=survival(atrisk cb) outs=out;
strata type;
time visit*status(0);
run;
Why? Probably because most of the graphics from analysis procedures are not intended to produce publication ready graphs but to provide information for analysis.
You have to set the option and then use the macros
%providesurvivalmacros
%compilesurvivaltemplates
AFTER you set the option macro variable.
You have to re-execute the macros each time to apply the values.
tried that. It didn't work...
%ProvideSurvivalMacros;
%let xOptions = label="Time to Event (months)"
linearopts=(viewmin=0 viewmax=12)
tickvaluelist=(0 2 4 6 8 10 12));
%CompileSurvivalMacros;
proc lifetest data=Work.Work atrisk plots=survival(atrisk cb) outs=out;
strata type;
time visit*status(0);
run;
am I missing something?
You might try posting the log if there are any messages.
Or some example data that will duplicate the (non-)behavior.
This is the error from the log:
12018 %CompileSurvivalMacros;
-
180
WARNING: Apparent invocation of macro COMPILESURVIVALMACROS not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
Many thanks!!
What version of SAS are you using?
Have you gone to http://support.sas.com/documentation/onlinedoc/stat/ex_code/141/templft.html
and downloaded the source file for the macros? Is the source file named ProvideSurvivalMacros.SAS and in your SASAUTOS path?
No, I haven't done that part as I assumed it is already built in in SAS.
Excuse my ignorance but what is the best way of downloading the template?
Also, I have been reading the following instrucyions:
How does one use the layout overlay statement with the proc lifetest..
I really think this should be easier, as in other programs like STATA it is much easier...
any ideas?
@Jest wrote:
No, I haven't done that part as I assumed it is already built in in SAS.
Excuse my ignorance but what is the best way of downloading the template?
I don't know if it is "best" but I copied and pasted the text from the code section into an editor and saved it.
You will really have to clarify what you mean by "use layout overlay". The ProvideSurvivalMacros uses Layout overlay in 5 different locations.
If you investigate the templates associated with Proc Lifereg there are over 50 templates associated. Depending on what I want to display I generally dump data to output sets and build graphs from scratch (or Graphics Designer) instead of attempting to create pulication quality graphics from analysis templates.
@Peter_C wrote:
In one of the macros at the link provided above by @ballardw, I was very surprised to see:
%scan(2,2-&outside)
Could someone explain what this does when &outside has value=0
?
Since the value scanned would be a single word and items more than 1 requested would yield a blank as the macro processor does the arithmetic and 2-0=2, so scans for the second "word".
See the log after running
%let k =%scan(1,2-0);
%put &k;
%let k =%scan(1 2,2-0);
%put &k;
@Peter_C wrote:
%scan(2,2-&outside)Seems a complicated way to produce 2 or nothing
Agreed. Certainly more than a tad obtuse.
I didn't read all of that code so I'm not sure if there are cases where &outside could be blank or a non-numeric appearing value which would be an error
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.