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;
PROC REPORT without blank line in header under across variable
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;
PROC REPORT without blank line in header under across variable
Cynthia Zender has a more recent paper ( https://www.mwsug.org/proceedings/2014/SS/MWSUG-2014-SS08.pdf ) that discusses this.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.
Ready to level-up your skills? Choose your own adventure.