turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Dynamic variables for survival plots

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-30-2011 05:03 PM

Hi,

I was tring to follow the code below (from the reference link) to modify my survival plot by adding dynamic variables,

... ...

layout overlay / . . .;

. . .

dynamic NObs1 NObs2 NObs3 NEvent1 NEvent2 NEvent3;

layout gridded / columns=3 border=TRUE autoalign=(TopRight);

entry ""; entry "Event"; entry "Total";

entry "1"; entry NEvent1; entry NObs1;

entry "2"; entry NEvent2; entry NObs2;

entry "3"; entry NEvent3; entry Nobs3;

endlayout;

endlayout;

... ...

I would like to make general statements so that the dynamic variables (say NObs*j*, where *j*=level of stratum) can take different values when I plug in stratifying variables with different levels. Can I use a Do loop to do that? but I was not sure how that might work in PROC TEMPLATE, please advise.

Thanks!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-30-2011 05:39 PM

What do you mean by dynamic variables in this context? What are you changing and what do you expect the output to be?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

07-01-2011 12:48 PM

The dynamic variables is the terminology used by SAS. It seems to me the they take the value of the result from the procedure and save it as a special variable, one could recall these variables in another procedure (say PROC TEMPLATE) to display the value.

In my example, I am trying to enhanced the default KM plot of the PROC LIFETEST precedure by adding number of event, censoring information and additional statistics. By default, the dynamic variable NObs and NEvent store the Number of Observation and Number of Event from the outcome, and if there are several stratifying levels, one can use NObs*j* and NEvent*j* (where *j* is the indication of the *j*th level/ stratum) to recall the variables (i.e. NObs1, NObs2 ..., NEvent1, NEvent2 ... etc). For my question, I wanted to make the (Graph Template) codes flexible enough so that it can populate the results irrespective of the number of levels the variables have.

P.S. A list of dynamic variables available for PROC LIFETEST can be found at http://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_lifetest_sec...

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-06-2011 02:03 PM

Currently, the GTL code does not support a DO loop structure. If you were building this template via macro, you could use a macro %do loop to construct the entries. However, that technique will not work here because the template must be pre-compiled for use by the LIFETEST procedure. The best you can do is code for the "worst case scenario". If you think that you will have, at most, 7 strata, then you can set up seven entries in the table, using a GTL "if" condition to wrap each set of entries conditional on the setting of the NOBSj dynamic variable. Each entry will look something like this:

if (Nobs4) entry "4"; entry NEvent4; entry Nobs4; endif;

Let me know if you have further questions.

Thanks!

Dan

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to DanH_sas

07-07-2011 11:17 PM

Works for me. Thanks!