The SAS Output Delivery System and reporting techniques

Unicode characters causing PROC REPORT row height changes in PDF output

Reply
Contributor
Posts: 22

Unicode characters causing PROC REPORT row height changes in PDF output

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.

 

 


WithoutUnicode.PNGWithUnicode.PNG
SAS Super FREQ
Posts: 8,816

Re: Unicode characters causing PROC REPORT row height changes in PDF output

Hi:
What is the rest of your code? Are you using PRINT, REPORT, DATA step to produce your report? I am guessing that the star is slightly raised. you could try changing the CELLPADDING attribute, but the WAY you change it will depend on the way you are creating the data for your destination.

As an example, if you were using PROC REPORT, I would recommend experimenting with different values for CELLPADDING like this:
proc report data=class(obs=5)
style(report)={cellpadding=5px};

cynthia
Contributor
Posts: 22

Re: Unicode characters causing PROC REPORT row height changes in PDF output

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.

SAS Super FREQ
Posts: 8,816

Re: Unicode characters causing PROC REPORT row height changes in PDF output

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:

star_nostar.png

 

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

Contributor
Posts: 22

Re: Unicode characters causing PROC REPORT row height changes in PDF output

[ Edited ]

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.

Ask a Question
Discussion stats
  • 4 replies
  • 539 views
  • 0 likes
  • 2 in conversation