Hi,
I was reading a paper on cancer on JAMA and the data was analyzed using SAS. The graphics were qualitatively high and I would like to learn a couple of things.
For example in this kaplan-meier curve, a box is added around the first letter of the title. I suppose this graph was constructed as a lattice in SGPlot or maybe Proc LifeTest. How is it possible to add this box? I usually use the newsurv macro for kaplan-meier curves. Is it possible to do it there too?
Thanks
Ubai
I think you'll need to use an annotation data set to put a box around just a part of a title.
ods graphics / noborder;
proc sgplot data=sashelp.class;
scatter y=weight x=height / group=sex;
title j=l box=1 "A Height and Weight for SASHELP.CLASS";
footnote j=l 'This version uses TITLE statement with BOX option';
run;
title;
%sganno;
data anno;
%sgtext(label=" A",
border="true",
drawspace="layoutpercent",
xc1="2",
yc1="105",
anchor="center",
justify="center");
%sgtext(label=" Height and weight for SASHELP.CLASS",
border="false",
xc1="24",
yc1="105",
widthunit="percent",
width=50,
justify="left");
run;
* pad= option is adding space at the top of the graphic for
* the title from the annotation data set ;
proc sgplot data=sashelp.class sganno=anno pad=(top=10pct);
scatter y=weight x=height / group=sex;
footnote j=l 'This version uses annotation data set for the title.';
run;
ods graphics / reset=all;
The screen shot below shows the graphic when using an annotation data set for the title.
I think you'll need to use an annotation data set to put a box around just a part of a title.
ods graphics / noborder;
proc sgplot data=sashelp.class;
scatter y=weight x=height / group=sex;
title j=l box=1 "A Height and Weight for SASHELP.CLASS";
footnote j=l 'This version uses TITLE statement with BOX option';
run;
title;
%sganno;
data anno;
%sgtext(label=" A",
border="true",
drawspace="layoutpercent",
xc1="2",
yc1="105",
anchor="center",
justify="center");
%sgtext(label=" Height and weight for SASHELP.CLASS",
border="false",
xc1="24",
yc1="105",
widthunit="percent",
width=50,
justify="left");
run;
* pad= option is adding space at the top of the graphic for
* the title from the annotation data set ;
proc sgplot data=sashelp.class sganno=anno pad=(top=10pct);
scatter y=weight x=height / group=sex;
footnote j=l 'This version uses annotation data set for the title.';
run;
ods graphics / reset=all;
The screen shot below shows the graphic when using an annotation data set for the title.
This should do it. Thank you.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.