I have a project containing about 15 process flows, each resulting in a subsequent custom report. Each custom report is set up to automatically export via EG as a PDF to a folder. Overnight, a scheduled task runs this project, but the PDF reports do not seem to update and the size of each PDF is 0 KB. When I manually export the PDF via the EG project they sometimes refresh with some showing 0 KB and others showing the actually file size (meaning they exported correctly).
No errors in SAS are generated. What would cause such an issue?
Specs:
SAS 9.4
EG 6.1 64-bit
Windows 7 64-bit
Adobe Reader XI
Thanks!
Nathan Och
Are you overwriting the PDF files or creating new ones?
I had this issue in BASE SAS and it was because I was overwriting the files and it didn't like to do that in a batch process mode, I had to make sure the files didn't exist prior to exporting them. If I was running it interactively it was fine. Took me a while to debug that one.
Reeza,
I am actually trying to overwrite the file, so it seems I am having the same issue that you were. How does one make this work without having an absurd number of PDF documents from not overwriting the old output?
Thank you for your insightful response, it seems that shouldn't be an issue with EG. We need a hot fix!
Nathan Och
I would contact tech support and see what they say. Or wait to see what others say, there are some power EG users on here who may have a better response.
In my case, it was only a "one time" process but for many iterations so I didn't need to keep files around. Otherwise you can use an OS script to clean up the files. I'm not sure it's an EG issue but perhaps an OS or PDF issue.
Hai.kuo,
I am merely exporting from the SAS report builder so there really isn't much coding involved in this instance. I had to use the report builder since I have multiple tables and graphs I want to present on one PDF page. Is there a way to incorporate this function within my project?
Thanks!
Nathan Och
Without looking into the details of your project, there really isn't much specific I can say. Here is what I would do in general:
1. Locate the element where you output/update the PDF report, and create and insert a new 'program' element right before it. The new program is where you can clean up the legacy PDFs.
2. Or convert the whole project into SAS code, and locate the same part mentioned in (1), then insert the 'clean up' code right before it.
Good luck,
Haikuo
I took your #1 advice and created a program to go into the folder and delete the old documents using this code:
FILENAME MyFile "C:\OutputFiles\File01.xls" ;
DATA _NULL_ ;
rc = FDELETE('MyFilel ') ;
RUN ;
FILENAME MyFile CLEAR ;
It performed the task perfectly (thank you for the advice), but the new file still reads 0 KB in size and does not properly open in Adobe Reader. It isn't overwriting anything at this point so I am at a loss.
Nathan Och
I am mystified why you are deleting a spreadsheet when your problem is with PDFs.
You caught me SASKiwi lol, I actually did replace the .xls with .pdf, I promise!
Reeze, same thing here. I deleted the '1' from myfile.
I feel like we've gotten off track .
Time for SAS tech support.
I set up a looping delete all command to first delete the existing files in the folder, and then turned off (unchecked the box) the overwrite existing output option.
%let path=d:\temp;
filename filrf "&path.";
data _null_;
did = dopen('filrf');
memcount = dnum(did);
do while (memcount>0);
fname = dread(did,memcount);
if scan(lowcase(fname),2,'.')='pdf' then do;
rcref = filename('fref',catx('\',"&path.",fname));
rcdel = fdelete('fref');
end;
memcount+-1;
end;
stop;
run;
This seemed to work with all of the pdf documents showing up with full content. I will have to watch it going forward to see if it actually does successfully continue.
Glad you found a way!
Why does fdelete reference myfile1 rather than myfile?
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.