BookmarkSubscribeRSS Feed
NathanOch
Obsidian | Level 7

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

13 REPLIES 13
Reeza
Super User

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.

NathanOch
Obsidian | Level 7

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

Reeza
Super User

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.

Haikuo
Onyx | Level 15

Besides OS script mentioned, you can also try FDELETE() before you output PDF files.

NathanOch
Obsidian | Level 7

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

Haikuo
Onyx | Level 15

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

NathanOch
Obsidian | Level 7

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

SASKiwi
PROC Star

I am mystified why you are deleting a spreadsheet when your problem is with PDFs. Smiley Wink

NathanOch
Obsidian | Level 7

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 Smiley Happy.

Haikuo
Onyx | Level 15

Time for SAS tech support.

NathanOch
Obsidian | Level 7

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.

Haikuo
Onyx | Level 15

Glad you found a way!

Reeza
Super User

Why does fdelete reference myfile1 rather than myfile?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 13 replies
  • 1501 views
  • 0 likes
  • 4 in conversation