I have added an additional section to an existing production job to validate some new parameters. This job has been in production for years and the part(s) I have added is not where the error is occurring. I can't figure out why it's failing when there's nothing new in that section - all the macro variables filling out the filename are resolving as expected.
This is the code that is failing. The first snip (also in the attached document) shows the log, the 2nd snip shows the production output that is still currently running.
/*** CREATE PDF AUDIT file ***/
%let dte = %sysfunc (today(),date9.);
%let tme = %sysfunc (time(), tod8.);
%let out_audt= /rsmprod/CMA/PRA_OUT/audit;
data _null_;
filen2 = compress("&dte"||':'||"&tme"||"_"||"CI"||"&PDF_campaign_id._&fileid."||"_"||"CJB_VALIDATION"||".pdf");
call symput ('afilnme', filen2);
run;
filename _audt "&out_audt./&afilnme";
ods listing close;
options center;
ods pdf file= out_audt startpage=no;
This is the problem statement:
ods pdf file= out_audt startpage=no;
There should be a FILENAME statement defining the OUT_AUDT FILEREF but I don't see one in the posted code. Alternatively OUT_AUDT could be a macro variable that points to an actual file in which case it should be defined like this:
ods pdf file= "&out_audt" startpage=no;
Shouldn't
filename _audt "&out_audt./&afilnme";
be
filename OUT_AUDT "&out_audt./&afilnme";
?
You can simplify this code with just:
filename OUT_AUDT "&out_audt/&dte:&tme._&CIPDF_campaign_id._&fileid._CJB_VALIDATION.pdf";
Hey @Anna_dlC! Looking at this line here:
ods pdf file= out_audt startpage=no;
out_audt is not defined as a filename in the snippet. Instead, it is named _audt as defined in this line:
filename _audt "&out_audt./&afilnme";
Try changing the ODS PDF statement to this:
ods pdf file= _audt startpage=no;
Or, change the filename statement to be out_audt:
filename out_audt "&out_audt./&afilnme";
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.