Hi
We have SAS installed on our local computer (Windows), and when I batch the program (right-click on the program and there is an option called "open with > sas 9.4 for windows" the log and lst are not getting outputted to the directory the program is running in, instead they are outputting to directory shown in the screenshot. Can any of you have any ideal on how we can make sure, when running the program, the log and lst files are outputted in the same directory?
I understand that we can using CMD prompt to batch the programs and that options seems working, but we wanted to figure out how we can achieve it this way.
Thank you for your time.
Make a copy of this link and modify the commandline with -log and -lst options to explicitly specify the location for these files.
Ok sure. We were able to successfully output the log and lst files when batching in command line, but wondering how we can achieve it without the command line?
As I already said, you must define a location for the files in the command that is the main element of the desktop link. You might do this by including a cd command in the link before the SAS invocation, or by using the options as already stated.
Can you please elaborate. For instance the programs are not necessarily will be located in one single folder and they can be located in different folders. Is this something we adjust in the configuration file?
How does your "batch" process know where to find the SAS Program?
If you want the log and lst in the folder the program resides then you have to either tell the system to change the default location, such as with the change directory statement in the batch program before the SAS executes.
OR
modify the SAS program to use Proc Printo to control output files.
If you want the location of the executing SAS program file executing in batch mode you should be able to get that from the SYSIN option.
%put The current program is %sysfunc(getoption(sysin));
The result of the %sysfunc call should contain the name of the program (maybe, you haven't been completely clear on your batch file contents). Parse the result for the the path. Use that for the either an X cmd or Sysexec to execute a change directory command or directly as part of Proc Printo syntax. I might prefer the Proc Printo approach as the X cmd approach may be turned off by your SAS admin.
Thank you so much for these details. I will explore these options further.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.