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.
Use an annotation data set to put a box around part of a title in a graphic
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.
Use an annotation data set to put a box around part of a title in a graphic
This should do it. Thank you.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.