BookmarkSubscribeRSS Feed
Siddhartha
Calcite | Level 5

We need to call the sas program from unix shell with the filenames to be passed as parameters. Please help us how can we pass a parameter to sas program from command line as argument and how it has to be handleled inside the SAS program. 

The scenario is to call a same sas program in the weekly and monthly job with the different set of files.

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, me personally, I would just have a folder, and put the relevant files in.  Then using specific software have the program run as and when on any files in that directory.  Far easier.  However if you have to then check out this article:

http://blogs.sas.com/content/iml/2015/03/16/pass-params-sysget.html

 

kannand
Lapis Lazuli | Level 10

Here is an example that might help you....

 

Unix Shell Code called "sasparm.sh"

 

sas sasparm.sas -sysparm "$1"

Your SAS program code called "sasparm.sas"

 

options mlogic mprint symbolgen;
%let var1="&sysparm";
data in;
  input_value=&var1;
run;

When you invoke the script, you may invoke like this in the command line...

 

sasparm.sh filename

Good Luck...!!!

Kannan Deivasigamani

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2216 views
  • 0 likes
  • 3 in conversation