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
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.
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.
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."
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.
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.
Ready to level-up your skills? Choose your own adventure.