BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ubai
Quartz | Level 8

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?

 

The graph (click here).

 

The paper (click here).

 

Thanks

Ubai

1 ACCEPTED SOLUTION

Accepted Solutions
SuzanneDorinski
Lapis Lazuli | Level 10

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 graphicUse an annotation data set to put a box around part of a title in a graphic

View solution in original post

2 REPLIES 2
SuzanneDorinski
Lapis Lazuli | Level 10

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 graphicUse an annotation data set to put a box around part of a title in a graphic

Ubai
Quartz | Level 8

This should do it. Thank you.

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

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1410 views
  • 1 like
  • 2 in conversation