As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Tips:Automatically assign Unix environment variables to SAS macro variables

From sasCommunity
Jump to: navigation, search

Did you know that on Unix platforms, you can automatically assign all Unix environment variables to SAS macro variables by adding these lines of code to your

/* Make macro variables from all environment variables */
filename set_list pipe "set";
data work.envvars;
    length name $255;
    length value $32512;
    infile set_list DLM='=' MISSOVER lrecl=32767;
    input name $ value $;
    if name ^= "'" then do;
        call symputx(name,value);

This is very useful in situations where you need to allow your business clients to set their own default macro variables; while at the same time limiting the number of people who can modify anything under your !SASROOT. Variable length shown above can be made smaller as needed.

More about file pipes

More about SYMPUT

Submitted by Darrel Cusey. Contact me at my Discussion Page.

This technique also works in Windows environments since the 'set' command is also valid under Windows.