BookmarkSubscribeRSS Feed
LawrenceHW
Quartz | Level 8
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
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
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
Tim_SAS
Barite | Level 11
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.
LawrenceHW
Quartz | Level 8
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.
deleted_user
Not applicable
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;

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
  • 4 replies
  • 1087 views
  • 0 likes
  • 4 in conversation