Programming Resources

Passing a system variable into a SAS session

It is sometimes useful to be able to pass a parameter into a SAS program, typically where SAS is being invoked from another application and the execution of the SAS program is dependent upon certain conditions within the calling application. For example, you may wish to direct output to a specific folder that changes each time the SAS program is executed.

 

 

Note: This syntax is for Windows, UNIX differs slightly.

Create Windows shortcut with target as:

"C:\Program Files\SAS Institute\SAS\V8\sas.exe" -CONFIG "C:\PROGRA~1\SASINS~1\SAS\V8\SASV8.CFG" -SYSIN myprog.sas -SYSPARM="Hello"

Set "Start in" as location of folder containing myprog.sas.


Example code for myprog.sas (using SAS sysparm function):

data _null_;
getparm=sysparm();
put "The parameter value is " getparm;
run;

Example code for myprog.sas (using SAS automatic macro variable):

data _null_;
put "The parameter value is &SYSPARM";
run;

 

Recommended SAS log analyser for SAS users:

Take a look at Elvis SAS log analyser. It takes a SAS log, either from the clipboard or from a saved file, and allows you to view it, navigate around it, search it and more. This makes working with large SAS logs much, much easier and faster than simply looking at the log in a non-specialised viewer such as a plain text editor, Internet Explorer or Notepad.

If you are looking for property in Piemonte Italy then we recommend alba property and piedmont property. Italian real estate.

Home > Programming Resources > SAS > Passing a system variable into a SAS session

Contact

Telephone: 020 7193 2301
Email: webcontact@fearntech.co.uk

Full Contact Details >

 

© 2001-2008 Fearntech Limited. All rights reserved.
website design kent | seo kent | website maintenance
Valid XHTML | Valid CSS