Hi
As @Kurt_Bremser already mentioned the ODS PDF is a global statement, and can not be executed within a DATA Step loop.
Since SAS9.3 there is a function DOSUBL, that allows you to execute global statements or complete steps while the DATA Step is running.
So find below two DATA Steps, showing two approaches, the second one is most similar to what you want to do.
ods pdf file="c:\temp\sample.pdf";
data _null_;
set sashelp.class;
length printLine $ 254;
printLine = catx(" ", "the person named:", name, "is", age, "old");
file print ods=(
GENERIC=ON
variables=(printLine)
);
put printLine ;
run;
data _null_;
set sashelp.class;
length printLine $ 254;
printLine = catx(" ", "the person named:", name, "is", age, "old");
rc = dosubl(cats("ods pdf text=", quote(printLine), ";") );
run;
ods pdf close;
... View more