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

Hello,

 

I am trying to create a series of scatter plots using a BY statement in PROC SGPLOT. The default option is to label each plot with "<variable name>=<value>". While I can control the values of the variable, is there a way to tell SAS I do NOT want to show the variable name? I just want to show the value of each BY group.

 

Thank you,

Brian

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You can suppress the appearance of the by line by using the option NOBYLINE;

You can use a title statement to specify just showing the value of the BY Variable(s) using the #byval option;

 

A brief example:

proc sort data=sashelp.class
   out=work.classsort;
   by age;
run;

options nobyline;
Title "Some titletext";
title2 #byval(age);
proc print data=work.classsort noobs label;
  by age;
run;
options byline;

Note there are not any quotes around the #byval and that the variable name may be specified. This would likely be helpful if you want just one of multiple by variables in the title or if you want the order in the title to different than on the by statement.

The "Sometext" title is optional but included to show how to work with a possibly existing title.

 

Another option though with different controls might be to use Proc SGPANEL and your by variable on a Panelby with statement with the NOVARNAME option.

 

View solution in original post

3 REPLIES 3
ballardw
Super User

You can suppress the appearance of the by line by using the option NOBYLINE;

You can use a title statement to specify just showing the value of the BY Variable(s) using the #byval option;

 

A brief example:

proc sort data=sashelp.class
   out=work.classsort;
   by age;
run;

options nobyline;
Title "Some titletext";
title2 #byval(age);
proc print data=work.classsort noobs label;
  by age;
run;
options byline;

Note there are not any quotes around the #byval and that the variable name may be specified. This would likely be helpful if you want just one of multiple by variables in the title or if you want the order in the title to different than on the by statement.

The "Sometext" title is optional but included to show how to work with a possibly existing title.

 

Another option though with different controls might be to use Proc SGPANEL and your by variable on a Panelby with statement with the NOVARNAME option.

 

bstarr
Quartz | Level 8
This works perfect, thank you!
Rick_SAS
SAS Super FREQ

For a discussion about how to customize titles in a BY-group analysis (including code and examples), see "How to use the #BYVAR and #BYVAL keywords to customize graph titles in SAS."

sas-innovate-white.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.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2313 views
  • 2 likes
  • 3 in conversation