Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KDS5
Calcite | Level 5

SAS 9.4 TS Level 1M2 

 

So whenever I run an SGPLOT with a by statement it automatically inserts a second title -- how do I remove that second title?

 

Here's my code (be nice as I'm just learning the graphics package):

 

ods graphics on;
ods listing style=DEFAULT image_dpi=300 gpath="FILE_LOCATION"; 
ods graphics / imagename="IMAGE_NAME";

PROC SGPLOT DATA=DATA_SET UNIFORM=SCALE;
BY VAR1 VAR2;
TITLE H=9pt 'TITLE: VAR1=#byval(VAR1) VAR2=#byval(VAR2)';

SCATTER X=X Y=Y / GROUP=ID MARKERATTRS=(SIZE=5) ;

XAXIS DISPLAY=(NOLABEL) TYPE=TIME INTERVAL=MONTH MINOR VALUEATTRS=(size=7);
YAXIS LABEL='LABEL' TYPE=LINEAR VALUES=(0 to 10 by 1) LABELATTRS=(size=8) VALUEATTRS=(size=7) valueshint;

KEYLEGEND / BORDER POSITION=RIGHT LOCATION=OUTSIDE ACROSS=1 TITLE='ID' SORTORDER=ASCENDING titleattrs=(size=7) valueattrs=(size=6);

RUN; ods graphics off;

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would guess that:

options nobyline;

Should suppress that, but I have nothing to test it on.

 

Nothing wrong with your code, other than using all uppercase and not indenting sections.

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would guess that:

options nobyline;

Should suppress that, but I have nothing to test it on.

 

Nothing wrong with your code, other than using all uppercase and not indenting sections.

KDS5
Calcite | Level 5

Thanks, RW9 --

 

I saw the "nobyline" syntax when Google searching for the answer but was trying to embed it in the ods line codes.

 

Thanks again,

KDS5

pkfamily
Obsidian | Level 7

Thanks for the solution and the post! Just what I was looking for. By using the nobyline option and combining with #byvar1 and #byval1, I was able to create my own custom titles for plots utilizing the by statement.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 3 replies
  • 9579 views
  • 3 likes
  • 3 in conversation