Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

Referencing BY Group Values Within Titles

When using 'by group' processing to output reports, the #byval function can be used to include the name of the 'by group' within the title.

In order to include the value on a report use the #byval function followed by the group variable to be displayed. Note that the nobyline option must be present in order to display the correct titles.

options nobyline;
proc sort data=sashelp.class out=work.class; by sex; run;
proc print data=work.class noobs; var name sex age; by sex; title "These people have a gender of #byval(sex)"; run;

Producing the following results:

These people have a gender of F
Name       Sex    Age
Alice       F      13
Barbara     F      13
Carol       F      14
Jane        F      12
Janet       F      15
Joyce       F      11
Judy        F      14
Louise      F      12
Mary        F      15

These people have a gender of M Name Sex Age Alfred M 14 Henry M 14 James M 12 Jeffrey M 13 John M 12 Philip M 16 Robert M 12 Ronald M 15 Thomas M 11 William M 15