Why is it so annoying to modify the axis in proc lifetest

Reply
Contributor
Posts: 40

Why is it so annoying to modify the axis in proc lifetest

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;

Super User
Posts: 11,343

Re: Why is it so annoying to modify the axis in proc lifetest

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.

Contributor
Posts: 40

Re: Why is it so annoying to modify the axis in proc lifetest

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?

Super User
Posts: 11,343

Re: Why is it so annoying to modify the axis in proc lifetest

You might try posting the log if there are any messages.

Or some example data that will duplicate the (non-)behavior.

Contributor
Posts: 40

Re: Why is it so annoying to modify the axis in proc lifetest

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!!

Super User
Posts: 19,815

Re: Why is it so annoying to modify the axis in proc lifetest

What version of SAS are you using?

Super User
Posts: 11,343

Re: Why is it so annoying to modify the axis in proc lifetest

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?

Contributor
Posts: 40

Re: Why is it so annoying to modify the axis in proc lifetest

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:

https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_templt_a000...

 

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?

 

 

Super User
Posts: 11,343

Re: Why is it so annoying to modify the axis in proc lifetest


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.

Valued Guide
Posts: 2,177

Re: Why is it so annoying to modify the axis in proc lifetest

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
?
Super User
Posts: 11,343

Re: Why is it so annoying to modify the axis in proc lifetest


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;

 

Valued Guide
Posts: 2,177

Re: Why is it so annoying to modify the axis in proc lifetest

%scan(2,2-&outside)Seems a complicated way to produce 2 or nothing
Super User
Posts: 11,343

Re: Why is it so annoying to modify the axis in proc lifetest


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

Valued Guide
Posts: 2,177

Re: Why is it so annoying to modify the axis in proc lifetest

Usually &outside is used in a boolean test. Its value is fixed as either 0 or 1.It is used in constructing proc template code - I do not think the %do loop provides much benefit over a repeat of the base code being generated with the few, minor variations 
Ask a Question
Discussion stats
  • 13 replies
  • 197 views
  • 2 likes
  • 4 in conversation