Data visualization with SAS programming

KM Plot line thickness

Reply
N/A
Posts: 1

KM Plot line thickness

Hi there,

I am using SAS 9.3 ( recently moved from SPSS to SAS.).

I am running KM survival curve and my questions is slightly "cosmetic" .

I want the KM survival lines thicker (double thicker than default) and different colors than default. Below is the code.

In output, I am having KM survival plot in perfect shape but not with the thickness and line colors I wanted.

Your help is much appreciated.

E.K.

***KM test;

  goptions lfactor=5 vsize=5 hsize=7 ftext=swissb noprompt;

  symbol1 c=black v=point h=1 i=steplj l=1;

  symbol2 c=blue v=point h=1 i=steplj l=1;

  symbol3 c=red v=point h=1 i=steplj l=1;

  symbol4 c=orange v=point h=1 i=steplj l=1;

  axis1  label=('Years')

       order=(0 to 7 by 1)

       minor=none;

  axis2  label=(a=90 'Proportion Free from Death')

       order=(0 to 1 by 0.2)

       minor=none;

Title 'XYZ';

proc lifetest data=dt plots=survival(atrisk (maxlen=13 outside(0.15)));

time KM_years * censor(0);

strata abc /order=internal;

run;

Super Contributor
Posts: 543

Re: KM Plot line thickness

Hi.

One way would be to use the ODS table to output the survival data in a SAS table, then use PROC (S)GPLOT to plot it.

If you run the ODS TRACE ON; command before your proc lifetest. in the log file you will get the SAS tables associated with this PROC.

Then run ODS TRACE OFF to stop getting the information in the log;

Anca.

SAS Super FREQ
Posts: 1,141

Re: KM Plot line thickness

Here is a blog article on this.  In the STEPPLOT, change the thickness of the line by using the following option:  STEPPLOT x=  y=  / LINEATTRS=(THICKNESS=2).

http://blogs.sas.com/content/graphicallyspeaking/2011/11/28/survival-plot-with-external-at-risk-tabl...

Super Contributor
Posts: 273

Re: KM Plot line thickness

Statkoc,

You are working with ods graphics off and trying to apply xchanges to  classical sas graphs

http://www.nesug.org/Proceedings/nesug06/po/po08.pdf

but there is another manner of working  i shall try to explain here

(working by default for 9.3.2 as ods graphics on; is active)

Lets take few similar code   ods graphics must be open !!!!!

first line open the sge possibility

second line rtestrict the work to only the graph plot (without any sas graph instructions):

ods html sge=on;

ods select lifetest.survivalplot;

proc lifetest data=muco.survie_cohorte_sexe graphics plots=(s) cs=none width=1 ;

time duree_vie*censure(0) ;

strata cohorte_sexe ;

survival out=muco.sortie_survie_cohortes_sexe_mkm ;

title 'Analyse de survie par cohorte de sexe 1' ;

title2 'Methode Kaplan-Meier' ;

run ;

ods select all;


you have some results   2 thin lines and colored in blue and red

aw2014-02-05_140016.png


Now open the sge  sas graphic editor 


aw2014-02-05_140110.png


and you can change the style from statistical to analysis

aw2014-02-05_140230.png


and the thickness of your graphic and a lot of others details on the two types of line: scatter and survival

with a right clic on a line


aw2014-02-05_140506.png

and saving it in png under a new name


You have a lot of different examples on survival code on pages 124-137 in my text

http://www.ined.fr/brochure_wielki/sasvolume2

BUT it is written in french


Some texts in english are indicated here :


about the SGE

Sanjay Matange ODS GRAPHICS EDITOR http://www.nesug.org/Proceedings/nesug08/po/po24.pdf


about survival see here a very good resume of ways

http://www.pharmasug.org/proceedings/2012/DG/PharmaSUG-2012-DG05.pdf


Finally you have also the ods graphical designer as clic click solution  see visual pages 138 to 141


the learning process could take time as you are starting in sas coming from spss.

a lot of sas users are not knowing yet what is explained here.

Good luck


HTH

Andre



Ask a Question
Discussion stats
  • 3 replies
  • 1310 views
  • 1 like
  • 4 in conversation