The SAS Output Delivery System and reporting techniques

PROC REPORT with SPLIT in column header, UNICODE and alignment

Reply
Occasional Contributor
Posts: 17

PROC REPORT with SPLIT in column header, UNICODE and alignment

Good day!

I run into a problem when trying to use the SPLIT option in PROC REPORT for a column header that contains a UNICODE character and that I would like to left-align. Specifically, if there is no UNICODE character in the column header where the split character is used, everything works as planned but when there is a UNICODE character, the second line is not left-aligned. Here is an example of code that would produce what I mention:

ODS PDF STYLE=JOURNAL;

PROC REPORT DATA=SASHELP.CLASS NOWD SPLIT="~";

     COLUMN NAME SEX AGE;

     DEFINE NAME / DISPLAY;

     DEFINE SEX /DISPLAY;

     DEFINE AGE/DISPLAY LEFT STYLE(HEADER)=[JUST=LEFT] STYLE(COLUMN)=[CELLWIDTH=1.8 IN]

     "Difference (^{UNICODE 0394}) adjusted~geometric mean percent change (95% CI)";

RUN;

ODS PDF CLOSE;

If I replace the UNICODE character with something else, the problem disappears:

ODS PDF STYLE=JOURNAL;

PROC REPORT DATA=SASHELP.CLASS NOWD SPLIT="~";

     COLUMN NAME SEX AGE;

     DEFINE NAME / DISPLAY;

     DEFINE SEX /DISPLAY;

     DEFINE AGE/DISPLAY LEFT STYLE(HEADER)=[JUST=LEFT] STYLE(COLUMN)=[CELLWIDTH=1.8 IN]

     "Difference (delta) adjusted~geometric mean percent change (95% CI)";

RUN;

ODS PDF CLOSE;

It looks like the first line of the column header is left-aligned but the other line(s) is/are centered (you can play with the CELLWIDTH option to observe this). Is there a way to work around this? This does not appear to be a problem with the RTF destination.

Thank you,

Daniel

SAS Super FREQ
Posts: 8,820

Re: PROC REPORT with SPLIT in column header, UNICODE and alignment

Hi:

  I think this is an issue where you want to open a track with Tech Support. If they do not know of a workaround for this behavior, they can seek help from the PDF developer. Your usage case illustrates the issue. I tried using the ^{newline 1} ESCAPECHAR function instead of the SPLIT= and noted essentially the same behavior.

  The only thing I can think of to do is to NOT use the SPLIT option, but that doesn't let you do header line-breaking the way you want.

  Other than that, to open a track with Tech Support, fill out the form at this link:

http://support.sas.com/ctx/supportform/createForm

cynthia

Occasional Contributor
Posts: 17

Re: PROC REPORT with SPLIT in column header, UNICODE and alignment

Thank you Cynthia for your quick reply! I have opened a track with TS and will post any relevant answer they will provide here Smiley Happy

Respected Advisor
Posts: 3,790

Re: PROC REPORT with SPLIT in column header, UNICODE and alignment

This workaround seems to work SAS 9.3 UNIX.  Add inline style element.

ods escapechar='^';
PROC REPORT DATA=SASHELP.CLASS NOWD SPLIT="~";
  
COLUMN NAME SEX AGE;
   DEFINE NAME / DISPLAY;
  
DEFINE SEX /DISPLAY;
  
DEFINE AGE/DISPLAY LEFT STYLE(HEADER)=[JUST=LEFT] STYLE(COLUMN)=[CELLWIDTH=3.8 IN]
     
"Difference (^{UNICODE 0394}) adjusted~^{style[just=left]geometric mean percent change (95% CI)}";
  
RUN;
SAS Super FREQ
Posts: 8,820

Re: PROC REPORT with SPLIT in column header, UNICODE and alignment

Data _null_ -- good workaround!

  I still think it's a good for Tech Support to take a look because my understanding of the style attribute in the header, was that it applied to all the contents of the header cell. I don't understand why using a split character would force the justification change in the same header cell, when the justification attribute for the AGE header was clearly set to left.

  I tried ^{newline 1} instead of the split, which caused the original behavior -- it didn't occur to me to "reset" the style or even try because I thought the HEADER setting would still be in effect.  I'm glad that you thought "out of the box" or, at least, thought of a different way to make things work "in the box".

cynthia

Occasional Contributor
Posts: 17

Re: PROC REPORT with SPLIT in column header, UNICODE and alignment

Hello Cynthia and data_null_,

First, I confirm that data_null_'s workaround also works in SAS 9.3 under Windows. Here is the reply I got from TS, with another way to work around the problem:

The problem that you are encountering is actually a defect in ODS PDF where the unicode function is causing double spacing.  It is explained a little further in this note http://support.sas.com/kb/33783.

I was able to get the correct alignment with the following workaround:

"Difference (^S={font_size=5pt}^{UNICODE 0394}^S={}) adjusted~geometric mean percent change (95% CI)";

Thank you both and thank you to SAS TS for all your helpful replies Smiley Happy

Daniel

Ask a Question
Discussion stats
  • 5 replies
  • 3934 views
  • 3 likes
  • 3 in conversation