BookmarkSubscribeRSS Feed
dr2014
Quartz | Level 8

Hi all,

I need advice on how to "plot lines for multiple groups within a sas variable". I used proc lifetest to get output dataset and used proc gplot to produce an rtf file.

 

proc lifetest data= abc method=KM outsurv=xyz plot=(s); time duration*censor (1,2);
strata group ; run;

 

The variable "group" has "6 categories" and proc gplot gives me plot points by default so I used symbol statement with i=spline option, but it gave me a line graph for only one group

 

Here is the code:

proc gplot data = xyz;
symbol1 i=spline;
plot survival*duration= group / vaxis=axis1 haxis=axis2 legend=legend1;;
run;

 

How can I get line graphs for all the categories within the group? Thanks.

 

 

 

 

3 REPLIES 3
Reeza
Super User
I would recommend using SGPLOT instead of GPLOT to graph your data. SG procedures produce higher quality graphics, is simpler to code IMO, and have more options to customize your graphics.

Here's some examples of SGPLOT code and survival curves
https://blogs.sas.com/content/graphicallyspeaking/2018/02/19/survival-plot-twist-using-sgplot-proced...
dr2014
Quartz | Level 8
Thank you for the recommendation.
Rick_SAS
SAS Super FREQ

If you submit

ODS GRAPHICS ON;

before your PROC LIFETEST call, the procedure should produce a survival plot automatically. 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1551 views
  • 1 like
  • 3 in conversation