BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

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?

1 ACCEPTED SOLUTION

Accepted Solutions
SuzanneDorinski
Lapis Lazuli | Level 10
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

1 REPLY 1
SuzanneDorinski
Lapis Lazuli | Level 10
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.  

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2460 views
  • 3 likes
  • 2 in conversation