options nobomfile; *byte-order mark;
%let progDir=%scan(&sysparm.,1,'|');
%let program=%scan(&sysparm.,4,'|');
%let dataYear=%scan(&sysparm.,5,'|');
Hi, above is the first few lines of a SAS code. I know it's scanning for words by position separated by |, 1st, 4th, and 5th words were assigned to the variables.
I can' understand the definition: SYSPARM enables you to pass a character string from the operating environment to SAS program steps and provides a means of accessing or using the string while a program is executing.
Since the default value for sysparm is null then where does the value for &sysparm come from? Is another program ran before or maybe in parallel with this program and sysparm gets the value from there?
Thanks in advance!
The value would come from the command string that initiates SAS.
For example the destop Icon I use to start SAS has the TARGET property of
"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
That is the command string.
If I wanted to add a sysparm option available every time I clicked on that icon would add something like
-sysparm= "list of words"
This could be handy if I wanted to have different Icons on the desktop and pass different values.
Also if a batch program is used to start SAS, possibly from a scheduling program as one example, then you could add the -sysparm option to the command line. Your batch program generator might pass different options. In the scheduler example I might want something different passed at "morning" program than for an "evening" program start.
The value would come from the command string that initiates SAS.
For example the destop Icon I use to start SAS has the TARGET property of
"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
That is the command string.
If I wanted to add a sysparm option available every time I clicked on that icon would add something like
-sysparm= "list of words"
This could be handy if I wanted to have different Icons on the desktop and pass different values.
Also if a batch program is used to start SAS, possibly from a scheduling program as one example, then you could add the -sysparm option to the command line. Your batch program generator might pass different options. In the scheduler example I might want something different passed at "morning" program than for an "evening" program start.
Yes! A batch from a scheduling program. Thank you! I have now find where the -sysparm and the values for it in other two files. I'm still not sure how the sysparm works but hopefully with more experience and learning I might be able to write code using it one day.
Thanks again!
The SYSPARM is on of those options that is very operationally dependent. I have used SAS off and on for over 30 years and never needed it. I did test it once but my organizations have never had a need for such. -SYSIN has been another matter though.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.