BookmarkSubscribeRSS Feed
YUYP
Calcite | Level 5

Dear all,

    I'm working on a KM plot using proc sgplot.

    I would like to change the thickness (thickness=2, for example) of the curves.

    The line thickness can be easily modified. But I encountered difficulty in changing thickness of the symbol "PLUS". Blow is the code.

    Your help is much appreciated!

data SurvivalPlotData;
input
obs time Time2 Survival AtRisk Event Censored Stratum StratumNum
;
cards;
1 0 0 1.00000 26 0 . 1 1
2 3 3 0.96154 26 1 . 1 1
3 7 7 0.92308 25 1 . 1 1
4 9 9 0.84615 24 2 . 1 1
5 10 10 0.76923 22 2 . 1 1
6 13 13 0.73077 20 1 . 1 1
7 15 15 0.69231 19 1 . 1 1
8 15 15 . 19 0 0.69231 1 1
9 17 17 . 17 0 0.69231 1 1
10 21 21 0.64904 16 1 . 1 1
11 22 22 0.60577 15 1 . 1 1
12 24 24 0.56250 14 1 . 1 1
13 28 28 0.51923 13 1 . 1 1
14 28 28 . 13 0 0.51923 1 1
15 28 28 . 13 0 0.51923 1 1
16 28 28 . 13 0 0.51923 1 1
17 28 28 . 13 0 0.51923 1 1
18 28 28 . 13 0 0.51923 1 1
19 28 28 . 13 0 0.51923 1 1
20 28 28 . 13 0 0.51923 1 1
21 28 28 . 13 0 0.51923 1 1
22 28 28 . 13 0 0.51923 1 1
23 28 28 . 13 0 0.51923 1 1
24 28 28 . 13 0 0.51923 1 1
25 28 28 0.51923 13 0 0.51923 1 1
26 0 0 1.00000 25 0 . 2 2
27 6 6 0.92000 25 2 . 2 2
28 11 11 0.88000 23 1 . 2 2
29 17 17 0.80000 22 2 . 2 2
30 19 19 0.72000 20 2 . 2 2
31 21 21 0.68000 18 1 . 2 2
32 24 24 0.56000 17 3 . 2 2
33 26 26 0.52000 14 1 . 2 2
34 28 28 . 13 0 0.52000 2 2
35 28 28 . 13 0 0.52000 2 2
36 28 28 . 13 0 0.52000 2 2
37 28 28 . 13 0 0.52000 2 2
38 28 28 . 13 0 0.52000 2 2
39 28 28 . 13 0 0.52000 2 2
40 28 28 . 13 0 0.52000 2 2
41 28 28 . 13 0 0.52000 2 2
42 28 28 . 13 0 0.52000 2 2
43 28 28 . 13 0 0.52 2 2
44 28 28 . 13 0 0.52 2 2
45 28 28 . 13 0 0.52 2 2
46 28 28 0.52 13 0 0.52 2 2
;
run;
proc sgplot data=SurvivalPlotData noborder;
yaxis label="Survival" min=0;
xaxis label="Days";
step x=time y=survival / group=Stratum name='s1' LINEATTRS=(pattern=solid thickness=2);
scatter x=time y=censored / markerattrs=(symbol=plus) name='s2';
scatter x=time y=censored / markerattrs=(symbol=plus) GROUP=Stratum;
keylegend "s1" "s2"/position=TOPRIGHT location=inside ACROSS=1 NOBORDER;
run;

2 REPLIES 2
djrisks
Barite | Level 11

Hello, to make the symbol bigger you need to use the SIZE option within the MARKERATTRS option in the second SCATTER statement. Also to make the symbol appear more thicker (and increase other items), you can use increase the dpi. Sometimes you need to use the option image_dpi instead of dpi.


Here is an example:

 

ods listing dpi=300;
proc sgplot data=SurvivalPlotData noborder;
yaxis label="Survival" min=0;
xaxis label="Days";
step x=time y=survival / group=Stratum name='s1' LINEATTRS=(pattern=solid thickness=2);
scatter x=time y=censored / markerattrs=(symbol=plus) name='s2';
scatter x=time y=censored / markerattrs=(symbol=plus size=20px) GROUP=Stratum ;
keylegend "s1" "s2"/position=TOPRIGHT location=inside ACROSS=1 NOBORDER;
run;

 

Many thanks,

 

Kriss

JeffMeyers
Barite | Level 11

It doesn't look like the option has appeared in SGPLOT yet, but within GTL there is another MARKERATTRS option called weight that will make the symbols thicker if you set to bold.  You could probably use TMPLOUT in your SGPLOT code into a template and then modify the MARKERATTRS in the provided code.

https://documentation.sas.com/?docsetId=grstatgraph&docsetTarget=p0yjbi9rz0z03tn1arz9ia9tgvic.htm&do...

 

Also going to plug my macro to make survival curves:

https://communities.sas.com/t5/SAS-Communities-Library/Kaplan-Meier-Survival-Plotting-Macro-NEWSURV/...

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 770 views
  • 1 like
  • 3 in conversation