Tuesday, January 13, 2009

By-Group value in title statement

By default, by-group values (#byvar, #byval and #byline) in the title statement can not change among by-groups. It is reasonable since the by-group section in the procedure output should be regarded as a whole. And title statement is for the whole output, not every by-group section.

Online doc says below
"Use NOBYLINE to suppress the automatic printing of BY lines in procedure output. You can then use #BYVAL, #BYVAR, or #BYLINE to display BYLINE information in a TITLE statement."

That means the new procedure output with NOBYLINE will be splitted into several by-group sections, and every section is regarded as a whole seperately. In this way, the by-group section should have its own title.

Sample code:

proc sort data=sashelp.class out=class;
by sex;
run;

options nobyline; *trick here;
ods html file="test.htm";
proc print data=class;
title "Subject list - #byval1";
var name sex height weight;
by sex;
run;
ods html close;

However, the trick is not necessary for graph output since every graph output is a whole actually. It should be noted that goption HBY=0 can also suppress byline in graph output.

Sample code:

options byline;
goptions hby=0;
proc gplot data=class;
by sex;
plot height*weight;
run;

For more control for byline style, please see http://support.sas.com/kb/23/325.html

No comments: