The SAS Output Delivery System and reporting techniques

ODS PDF Text and automatic new line

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

ODS PDF Text and automatic new line

Hi all. I have a proble with the ods pdf text. I have to write a title page on a report, that takes string values from a macro variable passed to a macro.

The problem is that sometimes, when the text cannot fit a single line, it goes to a new one. And while sometimes all goes ok, some other time the space between the first and the second line is really too huge.

This is the macro that genrate the page:

%MACRO GENERA_COPERTINA_PROVINCIA(PRVC, PRST, LBLPROV=SI);
    TITLE1 " ";
	%GENERA_FOOTNOTE;
    ods layout start rows=1 row_gutter=0cm columns=1 column_gutter=0cm column_widths=(27cm);
        ods region column=1 row=1;
            ODS PDF TEXT="^15n ^S={font_size=22pt}Specialistica Ambulatoriale^3n";
            ODS PDF TEXT="^S={font_size=33pt}MAIN PAGE TITLE^7n";
			%if &LBLPROV.=SI %then %do;
				ODS PDF TEXT="^S={font_size=28pt}String &PRVC.^2n";
			%end;
			%else %do;
				ODS PDF TEXT="^S={font_size=28pt}&PRVC.^2n";
			%end;
			ODS PDF TEXT="^S={font_size=22pt}(some observations)^6n";
			ODS PDF TEXT="^S={font_size=25pt}Title:^1n";
			ODS PDF TEXT="^S={font_size=25pt}&PRST.^3n";
			ODS PDF TEXT="^S={font_size=22pt}time span:^1n";
			ODS PDF TEXT="^S={font_size=22pt}&TREND_RIF.";
    ods layout end;
%MEND GENERA_COPERTINA_PROVINCIA;

The problematic text is 

ODS PDF TEXT="^S={font_size=25pt}&PRST.^3n";

I attach an example of the output string with wrong spacing...

 

Any idea on how to solve?

 

Thanks all Smiley Happy 


RightSpacing.pngWrongSpacing.png

Accepted Solutions
Solution
‎10-16-2015 06:31 AM
SAS Super FREQ
Posts: 8,819

Re: ODS PDF Text and automatic new line

Hi:
The syntax you show for the newline ^3n and ^2n is older syntax which was changed between SAS 9.1.3 and SAS 9.2. This really needs to be debugged by Tech Support and the ODS and PDF experts there. I would recommend that you open a track with Tech Support.

cynthia

View solution in original post


All Replies
Super User
Posts: 11,121

Re: ODS PDF Text and automatic new line

I would first verify the content of the macro variable. Since you do not describe how it is created other than comes from a macro, there is a chance that the generated macro contains either a line feed character or many spaces making the line in effect more than 2 print lines long.

Occasional Contributor
Posts: 15

Re: ODS PDF Text and automatic new line

Hi.

The macro just contain a string with no spaces and no line feed characters. It comes from a line of code generated as

call symput(compress("titlelabel"||left(put(_N_,4.))), %bquote(strip(PUT(COLUMN,$FORMAT.))));

in a data step that generate a lot of this macro variable that in every step are passed to the macro.

Solution
‎10-16-2015 06:31 AM
SAS Super FREQ
Posts: 8,819

Re: ODS PDF Text and automatic new line

Hi:
The syntax you show for the newline ^3n and ^2n is older syntax which was changed between SAS 9.1.3 and SAS 9.2. This really needs to be debugged by Tech Support and the ODS and PDF experts there. I would recommend that you open a track with Tech Support.

cynthia
Occasional Contributor
Posts: 15

Re: ODS PDF Text and automatic new line

Hi Cynthia.

I modified the code for using the "new" tag available from version 9.2, and now the problem no longer appears. Thanks for the reply Smiley Happy

 

%MACRO GENERA_COPERTINA_PROVINCIA(PRVC, PRST, LBLPROV=SI);
    TITLE1 " ";
	%GENERA_FOOTNOTE;
    ods layout start rows=1 row_gutter=0cm columns=1 column_gutter=0cm column_widths=(27cm);
        ods region column=1 row=1;
            ODS PDF TEXT="^{newline 15} ^{style[font_size=22pt]Specialistica Ambulatoriale ^{newline 3}}";
            ODS PDF TEXT="^{style[font_size=33pt]MAIN PAGE TITLE ^{newline 7}}";
			%if &LBLPROV.=SI %then %do;
				ODS PDF TEXT="^{^style[font_size=28pt]String &PRVC.^{newline 2}}";
			%end;
			%else %do;
				ODS PDF TEXT="^{style[font_size=28pt]&PRVC. ^{newline 2}}";
			%end;
			ODS PDF TEXT="^{style[font_size=22pt](some observations) ^{newline 6}}";
			ODS PDF TEXT="^{style[font_size=25pt]Title: ^{newline}}";
			ODS PDF TEXT="^{style[font_size=25pt]&PRST. ^{newline 3}}";
			ODS PDF TEXT="^{style[font_size=22pt]time span: ^{newline}}";
			ODS PDF TEXT="^{style[font_size=22pt]&TREND_RIF.";
    ods layout end;
%MEND GENERA_COPERTINA_PROVINCIA;
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 861 views
  • 0 likes
  • 3 in conversation