I have added a Unicode "star" character to my PROC REPORT output, but it causes the row heights in the report to be too tall, with lots of wasted space. I'm writing to ODS PDF output, if that helps.
My output examples both with and without the Unicode character are attached.
My code to create the text value is this:
SIR_int="^{unicode 2605} Better";
At this point, I'm open to alternatives to using the Unicode character.
Yes, I am using PROC REPORT, and I have set various cellpadding values. My code is:
**Create Report**;
proc report data=report_&infection split='\'
style(report)={cellspacing=0 cellpadding=2}
style(header)={ background=cxE0E0EB foreground=black font_face=calibri font_weight=bold font_size=8pt}
style(column)={ background=white foreground=black font_face=calibri font_weight=medium font_size=8pt bordertopcolor=white};
column unit infCount exp1 sig SIR_int row printed_row;
define unit / display center "Unit Type" style(column)={width=31.75%} ;
define infCount / display "Observed\&infText" center style(column)={width=17.75%};
define exp1 / display "Predicted\&infText" center style(column)={width=17.75%};
define SIR_int / display center "How Does This Facility\Compare to the National\Experience?" style(column)={width=31.75%};
define sig / display noprint;
define row / order noprint;
define printed_row / display noprint;
** Use the appropriate font/color for SIR interpretation text;
compute SIR_int;
if sig=1
then call define(_col_,"style", "style={color=black}");
else if sig=2
then call define(_col_,"style", "style=[color=red]");
else if sig=3
then call define(_col_,"style", "style=[color=green]");
else if sig=4
then call define(_col_,"style", "style=[color=black]");
endcomp;
compute printed_row;
if unit = "All reporting units" or unit = "Facility-wide inpatient" then do;
do i = 1 to 5; ** column sequence from column statement above, so for cols 1 to 5;
** "merge" means to NOT overwrite other styles on this cell;
call define(i,"style/merge","style={font_weight=bold}");
if printed_row > 1 then do; ** write overline for this row if it is not the only row in the output;
call define(i,"style/merge","style={bordertopcolor=black}");
end;
end;
end;
endcomp;
run;
I also tried setting cellpadding=2px and 1px (in addition to just cellpadding=2, as above), and no change in output.
I'm not sure it's my code that's causing the issue, though. The same issue is in a PROC REPORT output you added as a response to the SAS Communities question entitled "Can a format use unicode characters and have different font sizes" back on 04-20-2015, where the PROC REPORT rows containing Unicode arrow-characters are significantly taller than the other rows.
HI:
I understand what you're saying and I see that it is related to that previous posting. When I ran a test just now, in SAS 9.4, this is what I got:
and here's the code I used:
title;
data class;
length newname $40;
set sashelp.class;
SIR_int="^{unicode 2605} Better";
newname = catt(SIR_int, '~', name);
run;
ods escapechar='^';
ods pdf file='c:\temp\with_and_without.pdf' startpage=no;
proc report data=class(obs=5);
column ('Without unicode character' name age sex height);
run;
proc report data=class(obs=5);
column ('With unicode character' newname age sex height);
run;
proc report data=class(obs=5)
style(report)={cellpadding=5px};
column ('cellpadding=5px' newname age sex height);
run;
ods pdf close;
With cellpadding=5px, the 3rd output does not exactly the same as the top output, but it is close. For a closer look at what's going on, you may want to open a track with Tech Support.
cynthia
Thanks, Cynthia_sas. Although when I use your example code I see the same results in the SAS Results Viewer window of SAS 9.4, when I write the results to a PDF file, I again see the extra spacing around the PROC REPORT table cells containing Unicode symbols.
As advised, I opened a track with SAS Tech Support yesterday. I received an update today, saying they believe this is a defect in SAS, and will update me if/when additional information is known. Until then, as a workaround, I'll find an appropriate ASCII character to use in place of the Unicode "star" character.
bnawrocki -- did you ever hear back from Tech Support on this track? I seem to be having the same trouble with NE and SE arrows (indicating a trend up or down). THANKS -craig
craig_dickstein:
I never heard back from Tech Support. I think I dropped it because I found a different way to produce the symbol without the padding issue, and I also switched jobs, so I didn't follow up with them. I haven't needed to use a Unicode character since then. Could you open an issue on this with Tech Support, and let us know what you find out here?
thanks -- I have submitted a problem track via the online facility. -craig
The result of my problem report is as follows:
"The spacing is a known issue that is being addressed in a future release of SAS. You can try setting a uniform column width as follows: proc report data=your_data style(column)=[cellheight=.25in];"
For my application CELLHEIGHT does not help.
-craig
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.