we install sas 9.4 on linux server and its a stand alone server. we run batch job using below command,
/path/to/sasbatch.sh /home/userid/test.sas -log /home/userid
we make alias "sas" for /path/to/sasbatch.sh and now running program like,
sas /home/userid/test.sas -log /home/userid
we still want to simplify it and wants to run using below command,
sas test.sas
what changes needs to be done to avoid writing full path to program when run from home dir and where to make changes so that logs gets redirect to home dir itself?
If you can use an environment variable at all depends on where your SAS codes are stored.
If they are always found in a specific subdirectory of a user's home, you can use $HOME as a starting point.
If they are in a directory where each user has a subdirectory, you could use /sas_codes/$USER.
The executable that you want to use as "sas" (be it the SAS binary, or an alias for a script) needs to be in a directory contained in your system PATH. Otherwise xou will have to use the absolute path whenever you call it.
You can make a copy of sasbatch.sh and adapt it so that it searches in specific directories for SAS codes and also puts the logs into specifc directories.
On the assumption that all SAS source code is in the user's home directory, you could also use:
sas ~/test.sas
Drawback is that people will forget to include the " ~/ ". But Kurt suggestion is a good one in that you can customize the script to make it foolproof.
If you can use an environment variable at all depends on where your SAS codes are stored.
If they are always found in a specific subdirectory of a user's home, you can use $HOME as a starting point.
If they are in a directory where each user has a subdirectory, you could use /sas_codes/$USER.
The executable that you want to use as "sas" (be it the SAS binary, or an alias for a script) needs to be in a directory contained in your system PATH. Otherwise xou will have to use the absolute path whenever you call it.
SAS is probably being invoked from /path-to/Lev1/SASApp/, hence why it's looking for the code there.
Try changing the directory to the directory containing the code first, then invoked SAS. Something like:
cd /my_code_directory
sas test.sas
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.