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
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
Daniel
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
Thank you Cynthia for your quick reply! I have opened a track with TS and will post any relevant answer they will provide here
This workaround seems to work SAS 9.3 UNIX. Add inline style element.
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
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
Daniel
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.
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.