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   ariley@stata.com (Alan Riley)
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: access to environment vars. in windows
Date   Wed, 16 Apr 2003 07:55:35 -0500

Gregory Branch (greg_branch@gfbonline.org) 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
(ariley@stata.com)
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index