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:   Fri, 9 Oct 2009 03:50:23 -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 <kmyers1@clearwire.net>
In-Reply-To:   <AAB35B2471C049F18576A5CB7F66DECF@KAM1720>
Content-Type:   text/plain; charset=ISO-8859-1

I have a program that starts SAS programs with SYSTASK. It uses SET to create and set variables that are used by the programs that are started with SYSTASK.

On 10/8/09, Kevin Myers <kmyers1@clearwire.net> wrote: > Null, > > I have long known about the SET system option, but never thought about using > it in an OPTIONS statement after SAS has already started. I always use the > SET option on the command line to start SAS, or in a SAS configuration file. > Even after receiving your message, I had some doubt as to whether this would > work for my current purposes. I suspected that it would merely create some > internal SAS pseudo-environment variable, rather than a true system > environment variable in the copy of the system environment belonging to the > SAS process. > > I am ecstatic to say, boy was I wrong!!! Using SET in an OPTIONS statement > worked absolutely perfectly, and helped solved a SAS-related problem that > has been driving me nuts for quite a while. I really owe you one! > > Regards, > Kevin M. > > > ----- Original Message ----- From: "Data _null_;" <iebupdte@gmail.com> > To: "Kevin Myers" <kmyers1@clearwire.net> > Cc: <SAS-L@listserv.uga.edu> > Sent: Thursday, October 08, 2009 20:38 > Subject: Re: Set Environment Variable Value from SAS > > > > 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. > > > -------------------------------------------------------------------------------- > > Details > > > 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 <kmyers1@clearwire.net> 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