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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 892 views
  • 1 like
  • 2 in conversation