So I'm currently trying to export a SAS dataset as an xlsx file within the task scheduler on Windows 10.
The code works when manually ran in SAS, it works when I run the batch file outside of the scheduler, but once I try to have the scheduled task run at its time, the program is unable to export the file and instead keeps assigning a file type of $$1. I really don't know what else to try. The code of interest is below as well as the log from the scheduled task and the batch manuallyr ran.
Code:
Yes. It has full admin rights. It works from that account both manually in SAS, when manually running the batch file, but just not in the scheduler.
Is that "Log from task scheduler" the SAS log? If so, it is incomplete. You should share the entire log, not just the error.
Since there is not result of your macro %put statement it is obvious that your log is incomplete.
Also I strongly suspect that the code you run from the scheduler is not the same. When %put the value of your outfile this is what I see:
178 %put outfile= "&webipath\&filename1" ; outfile= "H:\\05-24-23_Monitoring_Report.xlsx"
See the two \\? It may be that for what ever reason one version doesn't mind the the extra \ but the other does. So either drop the \ from the webipath value or from the Outfile. If you want to keep the \ in the webipath variable then use
outfile = "&webipath.&filename1"
Also, does the machine running the scheduler have the H: drive? Does the session running it have permissions to write there?
Question: why do you have that %let Filename1 inside of a data step? None of the code involved needs such.
174 %let webipath = H:\; 175 %let filename1 = %sysfunc(putn("&sysdate9"d,mmddyyd8.))_Monitoring_Report.xlsx; 176 %put &filename1; 05-24-23_Monitoring_Report.xlsx
I suggest you double check the H drive existence by logging onto the machine running the SAS batch job with the same account used to schedule it just to confirm. Also try manually copying a file to the same H folder as a test. SAS obeys OS permissions so there is something going on at the OS level you might have missed.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.