I was trying to get PROC REPORT to suppress blank headers created under the ACROSS variable values.
There is a nice paper ( https://support.sas.com/rnd/papers/sgf07/sgf2007-report.pdf ) that shows a method that works when displaying a statistic, but it does not work when you are using the ACROSS feature to display a text field.
Here is the sample data and code used by the paper.
data example;
input Type $ Color $ Season $ Cost;
cards;
flower purple winter 1000
flower pink spring 2000
;
run;
proc report nowd data=example;
column type cost,season;
define type / group;
define season / across ' ';
define cost / ' ';
run;
The "trick" is to reverse the order of the across and sum variable in the COLUMN statement, putting the sum variable before the comma and the across variable after the comma.
Now if I try to use the same trick to display the character variable COLOR. Note that to get PROC REPORT to display a character variable under an across variable you need to include at least one numeric variable, which you do not need to print.
proc report nowd data=example;
column type (color cost),season;
define type / group;
define season / across ' ';
define color / display ' ';
define cost / ' ' noprint;
run;
The blank headers come back.
Does anyone know if there is a way to make those blank headers go away?
proc report nowd data=example;
column type color,season cost;
define type / group;
define season / across ' ';
define color / display ' ';
define cost / ' ' noprint;
run;
Cynthia Zender has a more recent paper ( https://www.mwsug.org/proceedings/2014/SS/MWSUG-2014-SS08.pdf ) that discusses this.
proc report nowd data=example;
column type color,season cost;
define type / group;
define season / across ' ';
define color / display ' ';
define cost / ' ' noprint;
run;
Cynthia Zender has a more recent paper ( https://www.mwsug.org/proceedings/2014/SS/MWSUG-2014-SS08.pdf ) that discusses this.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.