Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: access to environment vars. in windows


From   [email protected] (Alan Riley)
To   [email protected]
Subject   st: Re: access to environment vars. in windows
Date   Wed, 16 Apr 2003 07:55:35 -0500

Gregory Branch ([email protected]) wrote
> The programming manual for V.7 SE lists an extended
> macro function for accessing the values of system
> environment variables by name from stata code. The
> text in the manual indicates that this is available in
> both Windows and Unix.  
> 
> To make a long story short, I have a common routine
> that I need to respond to a machine-specific
> parameter, and it would be vary nice if I could get at
> a the windows environment variables.

System environment variables may be accessed with the -env-
extended macro function.  Here is an example:

   . local x : env PATH

The local macro -x- will now contain whatever Windows has in the
PATH environment variable, and subsequent references in Stata
code to `x' wil be replaced with the contents of PATH.


--Alan
([email protected])
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index