BookmarkSubscribeRSS Feed
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.

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:


Lapis Lazuli | Level 10

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


Unix Shell Code called ""


sas -sysparm "$1"

Your SAS program code called ""


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

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

Good Luck...!!!

Kannan Deivasigamani


Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 3 in conversation