Hi,
First of all I want to apologise in advance for my ignorance, I'm hoping to ask quite a generic question.
At work, I have used some code as a basis for something I have coded up myself that starts off by moving an Excel template sheet from a network drive into a folder in the Linux server that SAS is housed on using this code: -
filename windows "###########/Template";
filename netapp "##########\promise_analysis";
data _null_;
file netapp("PROM_SUMMARY.xlsx") recfm=n;
infile windows("PROM_SUMMARY_TEMPLATE.xlsx") recfm=n;
input c $CHAR1.;
put c $CHAR1. @@;
run;
Then, new data is created in SAS and exported to the Excel sheet like this: -
proc export data = prom_summary
outfile = ############/PROM_SUMMARY.xlsx'
dbms = xlsx replace;
sheet = PROM_SUMMARY;
run;1
And finally, the populated Excel sheet is moved back to the network drive like this.
filename windows "###########\Promise_Analysis";
filename netapp "###########\promise_analysis";
data _null_;
file windows("PROM_SUMMARY.xlsx") recfm=n;
infile netapp("PROM_SUMMARY.xlsx") recfm=n;
input c $CHAR1.;
put c $CHAR1. @@;
run;
My question is that when I run the process flow in full, the sheet that is move back to the network drive is the template without any updated data in it. If however, I run the last part of the process flow a second time, the populated sheet is copied over. The code I have used as a basis does the job correctly and I can't see anything in the log to suggest why this would be happening. Is there anything blatantly obvious that anyone can point out that I may be doing wrong?
Many thanks,
Rob