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

I can't seem to get the display I need for the output of sgplot with a by-group option. The output should go to ODS PDF.

 

If I don't use options nobyline the text displayed above each plot is "#byvar1=#byval1" and I would like it to be only "#byval1". If I disable byline, and try to set the plot title to title "#byval1" then only the first plot gets the title printed above. Here is my code

/* prepare the data */
proc sort data=sashelp.class out=c;
   by sex;
run;

/* ODS options */
option papersize=(10in 5.63in) ;
option nodate nonumber;
ods escapechar = "^";

options  leftmargin = .1in
 rightmargin = .1in
 topmargin = .1in
 bottommargin = .05in ;

ODS _ALL_ CLOSE;
TITLE; 
FOOTNOTE ;

ODS PDF FILE="output.pdf"  
	style = Styles.Pearl NOBOOKMARKGEN nogtitle nogfootnote dpi = 300 ;

options byline;

ods graphics / width=4.5in height=1.9in;
ods layout gridded columns=2 rows=1 advance=bygroup;

proc sgplot data=c ;
   scatter y=weight x=height;
   by sex;
run;

ods layout end; 
ODS PDF CLOSE;

This produces the following output:

with_byline.png

 

If I change the following in the code:

options nobyline;

proc sgplot data=c ;
   scatter y=weight x=height;
   by sex;
   title "#byval1";
run;

I get this output:

without_byline.png

 

Is there any way to achieve what I want to do?

1 ACCEPTED SOLUTION

Accepted Solutions
MDaniel
Obsidian | Level 7

The fix is amazingly simple and I should have thought about this earlier - gtitle needs to be enabled when defining the ODS. Code would look like this:

 

ODS PDF FILE="output.pdf"  
	style = Styles.Pearl NOBOOKMARKGEN gtitle nogfootnote dpi = 300 ;
	
options nobyline;	
	
proc sgplot data=c ;
   scatter y=weight x=height;
   by sex;
   title "#byval1";
run;	

View solution in original post

1 REPLY 1
MDaniel
Obsidian | Level 7

The fix is amazingly simple and I should have thought about this earlier - gtitle needs to be enabled when defining the ODS. Code would look like this:

 

ODS PDF FILE="output.pdf"  
	style = Styles.Pearl NOBOOKMARKGEN gtitle nogfootnote dpi = 300 ;
	
options nobyline;	
	
proc sgplot data=c ;
   scatter y=weight x=height;
   by sex;
   title "#byval1";
run;	

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 1137 views
  • 0 likes
  • 1 in conversation