I need to process a dynamic document. When the document is short it works great. When it is too long the text disappears from the PDF. Attached is a sample SAS
code. If the following lines are starred:
% hachpala (8);
% hachpala (9);
The file comes out fine, otherwise the page goes wrong. Why? What can be done to make it work well?
%let koteret1=^S={font_size=10pt font_face=Arial FONT_WEIGHT=Bold just=right};
%let text1=^S={font_size=10pt font_face=Arial just=right};
%let kav_mafrid=^S={font_size=8pt color=bgr }____________________________________________________________________________________________________________________________;
%let path=C:\Users\xxx\Desktop;
ods _all_ close;
options
orientation = portrait spool lrecl=max urlencoding=utf8 dev=actximg locale=HE_IL papersize= A4
nodate nonumber topmargin= 0cm bottommargin = 0cm leftmargin = 1cm rightmargin = 1cm printerpath= pdf;
ods noproctitle;
title;
footnote;
ods escapechar = '^';
ods pdf file="&path.\test.pdf" /*uniform*/ /* notoc*/ startpage=yes /*gtitle gfootnote*/ ;
title1 j=center "סמל ארגון";
title2 j=left "כותרת שמאל"
j=center "^{style [font_size=12pt font_face=Arial FONT_WEIGHT=Bold color=bgr ] שם ארגון }"
j=right "כותרת ימין" ;
footnote1 j=center "^{lastpage} דף ^{thispage} מתוך";
%macro hachpala(mis_hadpasa);
ods layout start columns=1;
ods region width=100% style={just=right};
ods pdf text=" &kav_mafrid ";
ods pdf text="^{ newline 1}";
ods pdf text="&koteret1 כותרת &mis_hadpasa";
ods pdf text=" &kav_mafrid ";
ods layout end;
ods pdf text="^{ newline 1}";
%macro ods_pdf_text(N);
ods pdf text="&text1 עמודה &N";
ods pdf text="&text1 עמודה &N";
ods pdf text="&text1 עמודה &N";
%mend;
ods layout start columns=4;
ods region width=25% style={just=right};
%ods_pdf_text(4);
ods region width=25% style={just=right};
%ods_pdf_text(3);
ods region width=25% style={just=right};
%ods_pdf_text(2);
ods region width=25% style={just=right};
%ods_pdf_text(1);
ods layout end;
%mend;
%hachpala(1);
%hachpala(2);
%hachpala(3);
%hachpala(4);
%hachpala(5);
%hachpala(6);
%hachpala(7);
%hachpala(8);
%hachpala(9);
ods pdf close;
ods _all_ close;
Which text disappears? Everything, some lines ?
With your locale options and such I can't reliably test your code as written on my system.
One coding style comment: It may be a good idea to keep things like MACRO definitions outside of ODS destination blocks.
It is definitely a good idea not to nest macro definitions inside other macros. It can be anywhere from annoying to extremely difficult to debug macro code when you make a logic mistake or typo involving scope of macro variables in any form. When a macro definition is nested in another macro your macro potentially changes with call to the outer macro.
I changed the previous one to be international. I took out the macro. It still does not work.
%let path=C:\Users\xxx\Desktop;
ods _all_ close;
options
orientation = portrait spool lrecl=max /* urlencoding=utf8*/ dev=actximg /*locale=HE_IL*/ papersize= A4
nodate nonumber topmargin= 0cm bottommargin = 0cm leftmargin = 1cm rightmargin = 1cm printerpath= pdf;
ods noproctitle;
title;
footnote;
ods escapechar = '^';
ods pdf file="&path.\test.pdf" /*uniform*/ /* notoc*/ startpage=yes /*gtitle gfootnote*/ ;
title1 j=center "organization icon";
title2 j=left "left title"
j=center "^{style [font_size=12pt font_face=Arial FONT_WEIGHT=Bold color=bgr ] organization name }"
j=right "right title" ;
footnote1 j=center "^{lastpage} ^{thispage} ";
%macro ods_pdf_text(N);
ods pdf text="&text1 column &N";
ods pdf text="&text1 column &N";
ods pdf text="&text1 column &N";
%mend;
%macro multiplication(print_N_);
ods layout start columns=1;
ods region width=100%;
ods pdf text=" &kav_mafrid ";
ods pdf text="^{ newline 1}";
ods pdf text="&koteret1 title &print_N_";
ods pdf text=" &kav_mafrid ";
ods layout end;
ods pdf text="^{ newline 1}";
ods layout start columns=4;
ods region width=25% style={just=right};
%ods_pdf_text(1);
ods region width=25% style={just=right};
%ods_pdf_text(2);
ods region width=25% style={just=right};
%ods_pdf_text(3);
ods region width=25% style={just=right};
%ods_pdf_text(4);
ods layout end;
%mend;
%multiplication(1);
%multiplication(2);
%multiplication(3);
%multiplication(4);
%multiplication(5);
%multiplication(6);
%multiplication(8);
%multiplication(9);
%multiplication(10);
ods pdf close;
ods _all_ close;
Hi:
I don't understand what you mean when you said that you have "made it international" . The macro definitions are still INSIDE the ODS PDF statements. Is something like this what you intend to produce? I notice that the ODS LAYOUT text that you're writing with the generated code is causing the Page 2 text to be overlaid with the other text strings. You need to define your LAYOUT and REGIONS to avoid this.
I changed a few things in your code. For example, I changed the footnote text to show the standard Page X of Y. I removed all the extraneous options and tried to simplify them. I removed the ODS PDF options that didn't seem relevant. I also, made up some fake values for the macro variables and changed the color for titles and footnotes. Here's the annotated code:
I still think working with Tech Support might be your best resource, since it seems that this is part of a possibly larger output creation and I'm not sure that your macro code is doing what you think it should be doing. Do you have a working program that produces what you want without having ANY macro code in it at all?
Cynthia
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.