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

Hello everyone,

 

I am trying to add an overall title for the by two yaxistables. I have attached a version of the sgplot graph I am working on. The output destination is the standard ODS HTML. I would like to put a tittle above each yaxistable shown by TITLE1 and TITLE2. I have tried to use the yaxistable TITLE option but the title text is added above each column of the table. I also tried to play around with a title2 statement by adding some leading blanks but that didn't work. Any other suggestions?

 

Thanks

 

 

image.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Your best bet, in this case, would be to use SGANNOtation. I would add a TITLE2 with a title of " " to add some space after the real title. There is a simple example below. If you need more details on SGANNO, you can refer to a paper I did on annotation several years ago: https://support.sas.com/resources/papers/proceedings11/277-2011.pdf

 

Hope this helps!

Dan

 

SGPlot.png

 

title "This is a Title";
title2 " ";

data anno;
retain x1space "wallpercent" y1space "layoutpercent" function "text"
       anchor "bottom" y1 100 width 40 textweight "bold";
label="Weight";
x1=116;
output;
label="Height";
x1=146;
output;
run;

proc sgplot data=sashelp.class sganno=anno;
hbar age / response=weight stat=mean;
yaxistable weight / stat=mean;
yaxistable weight / stat=median;
yaxistable height / stat=mean;
yaxistable height / stat=median;
run;

View solution in original post

4 REPLIES 4
ballardw
Super User

At least provide the code you are using currently. Otherwise we have to make so many guesses as to what you have that it is not practical. Better would be to provide example data in the form of a data step so we can actually test code against representative data.

Rick_SAS
SAS Super FREQ

The doc for the YAXISTABLE statement shows that you can use the TITLE= option on the YAXISTABLE statement. It also supports a LABEL= option. 

 

Or are you saying that you want to use the current TITLE1 and TITLE2 values, regardless of what they are?  In that case, you need to read dictionary tables to get the TITLE1 and TITLE2 into macro variables, then use those macro variables on the TITLE= or LABEL= option, as explained above. The details and an example are in the article "How to get the current TITLE in SAS." 

DanH_sas
SAS Super FREQ

Your best bet, in this case, would be to use SGANNOtation. I would add a TITLE2 with a title of " " to add some space after the real title. There is a simple example below. If you need more details on SGANNO, you can refer to a paper I did on annotation several years ago: https://support.sas.com/resources/papers/proceedings11/277-2011.pdf

 

Hope this helps!

Dan

 

SGPlot.png

 

title "This is a Title";
title2 " ";

data anno;
retain x1space "wallpercent" y1space "layoutpercent" function "text"
       anchor "bottom" y1 100 width 40 textweight "bold";
label="Weight";
x1=116;
output;
label="Height";
x1=146;
output;
run;

proc sgplot data=sashelp.class sganno=anno;
hbar age / response=weight stat=mean;
yaxistable weight / stat=mean;
yaxistable weight / stat=median;
yaxistable height / stat=mean;
yaxistable height / stat=median;
run;
spirto
Obsidian | Level 7

Thank you Dan. That worked!

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
  • 4 replies
  • 767 views
  • 2 likes
  • 4 in conversation