LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2009, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 8 Oct 2009 20:38:14 -0500
Reply-To:   "Data _null_;" <iebupdte@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Data _null_;" <iebupdte@GMAIL.COM>
Subject:   Re: Set Environment Variable Value from SAS
Comments:   To: Kevin Myers <>
In-Reply-To:   <2BC166D0A5084D358D447B0BEB5C64D1@KAM1720>
Content-Type:   text/plain; charset=ISO-8859-1

SET System Option: Windows

Defines a SAS environment variable Default: none Valid in: configuration file, SAS invocation, OPTIONS statement, SAS System Options window Category: Environment control: Files PROC OPTIONS GROUP= ENVFILES Windows specifics: Values intended to represent files or paths must be valid under Windows

-------------------------------------------------------------------------------- Syntax Details See Also


Syntax -SET SAS-variable "value" | ("value-1"...<"value-n">) SET=SAS-variable "value" | (" value-1"...<"value-n">)

SAS-variable specifies the environment variable to define.

value specifies the value or set of values to assign to the environment variable. If value is a pathname that contain spaces, enclose value in quotation marks.



This is analogous to defining a Windows environment variable with the Windows SET command. One way to use the SET system option is to set up environment variables that represent commonly used external files. For example, the following code defines an environment variable for the sample source library:

-set sampsrc (!sasroot\base\sample !sasroot\stat\sample !sasroot\graph\sample)

When you refer to SAMPSRC as a library name during your SAS session, SAS automatically assigns the library with the directories listed. Note that !sasroot is also a SAS environment variable that represents the root directory of your SAS installation, and is typically assigned in the SAS configuration file.

Environment variables can only be used as a libref if you use the SET system option at SAS invocation and not in an OPTIONS statement.

If you specify SET on the command line when you start SAS, the variable will be set only for that SAS session. To set an environment variable for repeated use, either add the SET system option to your configuration file or create a Windows environment variable.

On 10/8/09, Kevin Myers <> wrote: > I need to set the value of an existing system environment variable from within SAS under Windows. This value needs to be set in the SAS copy of the environment, NOT in the copy of the environment for a child process, and not in the environment of the process that started SAS. So simply executing an operating system SET command won't work. The environment that needs to be accessed is the same copy of the environment from which %SYSGET() and the SYSGET() data step function obtain their values. But I need to go the other way, with something that might be thought of as %SYSPUT or SYSPUT(), except that those functions don't appear to exist. > > I could swear that I have done this in the past, but I can't remember how, and I haven't been able to come up with anything by looking through the docs or searching the web. > > Anyone out there know how to accomplish this? > > Thanks, > Kevin M. >

Back to: Top of message | Previous page | Main SAS-L page