The SAS Output Delivery System and reporting techniques

Removing blank headers in PROC REPORT using across and display variables

Accepted Solution Solved
Reply
Super User
Super User
Posts: 7,255
Accepted Solution

Removing blank headers in PROC REPORT using across and display variables

[ Edited ]

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.

image.png

 

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.  

 image.png

Does anyone know if there is a way to make those blank headers go away?


Accepted Solutions
Solution
‎10-14-2017 05:01 PM
Frequent Contributor
Posts: 92

Re: Removing blank headers in PROC REPORT using across and display variables

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 variablePROC 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.  

View solution in original post


All Replies
Solution
‎10-14-2017 05:01 PM
Frequent Contributor
Posts: 92

Re: Removing blank headers in PROC REPORT using across and display variables

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 variablePROC 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.  

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 313 views
  • 2 likes
  • 2 in conversation