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 🙂
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.
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.
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 🙂
%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;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.