Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: how to run do files in two computers, one with Windows XP,another with Vista


From   "Kyle K. Hood" <[email protected]>
To   [email protected]
Subject   Re: st: how to run do files in two computers, one with Windows XP,another with Vista
Date   Tue, 03 Jun 2008 22:56:19 -0400

Adrian,

In general, you can save quantities and local and global macros using extended functions. environment (or env for short) is one such function. See

. help extended_fcn

for a full list of them. The syntax is

local blah : env env_var_name
or
global blah : env env_var_name

Here, env tells stata to return an environment variable from the windows OS and put it in blah (local or global tells it to use a local or global macro). These variables are used for a number of purposes, often to store paths (other programs use them, for example, to access your processor or system type to determine compatibility).

You can google environment variables windows xp to determine what they are called. Some cannot be messed with, some can, but all can be accessed. A sample website that I got from googling these terms is http://vlaurie.com/computers2/Articles/environment.htm

You can alter/add environment variables in Control Panels -> System -> Advanced (tab) -> Environment Variables (button). However, some in the list on the website do not appear on this control panel.

Kyle

Adrian de la Garza wrote:

Thanks a lot to everyone for your suggestions. Michael Blasnik's and James Hassell's answers look like they could be my best shot... but I really have no idea how to do the things you suggest, as I have never used global variables or environment variables. Could you please be a little bit more specific and tell me a bit more in detail what I'd have to do or read? T

Thank you very much. Adrian

From: [email protected]
To: [email protected]
Subject: Re: st: how to run do files in two computers, one with Windows XP, another with Vista
Date: Tue, 3 Jun 2008 17:48:04 -0500

Adrian could use the extended macro function -env- to
get the information from the operating system's environment variables.

For example:

. local homepath : env HOMEPATH
. local homedrive : env HOMEDRIVE
. local mypath `homedrive'`homepath'
. display `"`mypath'"'

To determine what environment variables are available, open a command
prompt in Windows, and type -set-.

Hope this helps.

-- James
[email protected]



Quick question regarding running do files in two separate computers.
My old laptop and my desktop both have Windows XP and I've been
running my do files with lines with the following contents:

cd "C:\documents and settings\adrian\my documents\research\"

and I've never had any problems. Now I have a new laptop with
Windows Vista and the directory where My Documents are saved no
longer comes after "documents and settings"...

what can I do in this case? Do I need to change all of my do files
or is there an easier fix?

Adrian
*
* 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/
_________________________________________________________________
Instantly invite friends from Facebook and other social networks to join you on Windows Live™ Messenger.
https://www.invite2messenger.net/im/?source=TXT_EML_WLH_InviteFriends
*
* 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/
*
*   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