The SAS Output Delivery System and reporting techniques

proc report spanning column headers

Reply
Contributor
Posts: 49

proc report spanning column headers

Hi all,

Is anyone aware of any options in PROC REPORT to swiych off the spanning of column headers when using characters such as "+". I have a report with a column header of "++" and this is, as expected, repeating "+" across the width of the column (> 2 characters in width).

So far the only solution I have been able to think of is to create a column header of "[++]" and this stops the spanning of the column header.

Has anyone got any other solutions or knows of a way of turning this spanning off?

Cheers,
Lawrence
SAS Super FREQ
Posts: 8,862

Re: proc report spanning column headers

Posted in reply to LawrenceHW
The use of special characters for spanning headers only works for LISTING. When you route your output to other ODS destinations, you should NOT get spanning headers, but should just see the character + or * once.

According to the doc,

In traditional (monospace) SAS output, if the first and last characters of a header are one of the following characters, then PROC REPORT uses that character to expand the header to fill the space over the column or columns:

:- = \_ .* +


so if you pick some character that's NOT in the above list (like the # or ^), you should NOT get repeating characters even in LISTING window.

cynthia
Super Contributor
Posts: 394

Re: proc report spanning column headers

Posted in reply to Cynthia_sas
That doc has been wrong for ages. The actual, from-the-horses-mouth list of expanding characters is:

- (dash)
. (period)
+ (plus)
_ (underscore)
= (equals)
* (asterisk)

Also the character specified by FORMCHAR(1), and < (less than) and > (greater than) when paired.

I expect the doc will be corrected in 9.2.
Contributor
Posts: 49

Re: proc report spanning column headers

Thanks for the swift reply. I still route PROC REPORT to the listing destination as that's what's required most of the time in my day-to-day job.

I'd already encountered the "<" ">" repeating functionality. I managed to get round the problem by inserting a blank character (using BYTE(160)) before and after the "++" and this stopped the spanning characters.

Another example of having to fool SAS into doing what you want it to do rather than it doing what it's been asked to do. Not that I'm complaining ... after all it keeps you on your toes.
N/A
Posts: 0

Re: proc report spanning column headers

Posted in reply to LawrenceHW
Neat problem.

The following comes close to what you're looking for - little modification might get you what you want.

%LET mch=+; * your spanning character;

FILENAME ftemp TEMP ;
FILENAME f2 'C:\TEMP\l.txt' ;

ODS LISTING FILE=ftemp;
PROC REPORT DATA=WORK.HOLIDAYS LS=142 PS=46 SPLIT="/" CENTER NOWD ;
COLUMN Date ("&mch&mch" Holiday Agency_Status );

DEFINE Date / ORDER FORMAT= DATE9. WIDTH=9 SPACING=2 RIGHT ORDER=INTERNAL "Date" ;
DEFINE Holiday / ORDER FORMAT= $22. WIDTH=22 SPACING=2 LEFT "&mch Holiday &mch" ;
DEFINE Agency_Status / ORDER FORMAT= $22. WIDTH=22 SPACING=2 LEFT "&mch Agency_Status &mch" ;
RUN;
ODS LISTING;

DATA _null_;
INFILE ftemp;
FILE f2;
INPUT;
* might want to modify the regexp following;
_infile_ = PrxChange("s/\&mch{3,}/&mch&mch/",-1,_infile_);
PUT _infile_;
RUN;

PROC FSLIST FILE=ftemp;
PROC FSLIST FILE=f2;
RUN;
Ask a Question
Discussion stats
  • 4 replies
  • 172 views
  • 0 likes
  • 4 in conversation