Biostat Macro Library

Mass Production of Survival Plots

%Survival and %SurvivalX reside in the departments SAS Macro Library and are enabled with the following SAS statements:

Libname biostat '\\BIO2\example\SASMacrosWindows';
Options Mstored SasMstore=biostat;

%Survival and %SurvivalX run Proc Lifetest, abbreviate the output, and create survival plots for a list of endpoints and survival times. The dataset must contain only one observation per subject. The Y axis may be specified, but it is suggested to be 0 to 100 by 10. Available plot styles are BlackWhite, Color(white background) or PowerPoint(blue frame, gold trim, black background). Graphs may be replayed 2, 4, 9 or 16 to a page. %SurvivalX allows the X axis to be specified.

Syntax:
%Survival(dataset,group,endpoints,survivaltimes,start,stop,by,style,replay);
%SurvivalX(dataset,group,endpoints,survivaltimes,start,stop,by,xstart,xstop,xby,style,replay);
    dataset:         Dataset to use.
    group:           Treatment group(Numeric).
    endpoints:     List of endpoints(Yes=1/No=0).
    survivaltimes: List of survival times(Numeric).
    start:             Y axis start(Numeric Constant).
    stop:             Y axis stop(Numeric Constant).
    by:                Y axis step(Numeric Constant).
    style:             BlackWhite, Color or PowerPoint.
    replay:           Number of graphs to display on a page(2, 4, 9 or 16).
    xstart:            X axis start(Numeric Constant).
    xstop:            X axis stop(Numeric Constant).
    xby:               X axis step(Numeric Constant).

Example:
%Survival(work.A,treatment,A B C D,At Bt Ct Dt,0,100,10,PowerPoint,9);
%SurvivalX(work.A,treatment,A B C D,At Bt Ct Dt,0,100,10,0,12,1,PowerPoint,9);

The default colors may be changed by defining a macro variable named “Colors”:

%Let Colors=Background_color Foreground_color Group1_color Group2_color Group3_color…;
%Let Colors=Blue Yellow Green Red Purple Black;

The default font of centx may be changed on all text by defining a macro variable named “Font”:

%Let Font=Simplex;

The position of the legend may be changed by defining a macro variable named "LegendOption":

%Let LegendOption=Position=(Inside Top Left) Across=2 Down=2;

This procedure creates a graphics catalog named “work.mplot”. The graphics catalog may be cleared by closing the graph window and running the following code.

Proc Datasets Library=work Memtype=Catalog;
    Delete mplot;
Run;

If you are running SAS interactively, this procedure will always replay the first set of graphs in the catalog. You may wish to reset the catalog between each procedure call.

Output: