BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Daniel
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Daniel
Obsidian | Level 7

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

View solution in original post

5 REPLIES 5
Cynthia_sas
SAS Super FREQ

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

Daniel
Obsidian | Level 7

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

data_null__
Jade | Level 19

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;
Cynthia_sas
SAS Super FREQ

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

Daniel
Obsidian | Level 7

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 11624 views
  • 4 likes
  • 3 in conversation