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

st: RE: Telling Stata what computer I am on


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: Telling Stata what computer I am on
Date   Tue, 25 Jan 2005 12:26:21 -0000

I would suggest identifying which computer you are on by giving a simple command that will fail on one machine and capturing the output, e.g.

cap cd d:
if _rc {
    *LAPTOP
}
else {
    *DESKTOP
}

David
[email protected]

-----Original Message-----
From: Kieran McCaul [mailto:[email protected]]
Sent: 25 January 2005 12:20
To: Statalist (E-mail)
Subject: st: Telling Stata what computer I am on


I work on two computers: one a desktop and the other a laptop.  The desktop
was setup with the hard-disk partition into C: and D: drives and my data and
programs are stored on the D: drive.

My laptop, however, has only a C: drive.  Therfore, if I write programs on
one they will not run on the other unless I change the C: to D: or visa
versa.

So I now put a global macro at the top of my programs to store the alternate
directory names something like this:

*DESKTOP
global thesisdata "D:\My Documents\Thesis\Analysis 2003\Setup"
global thesis "D:\My Documents\Thesis\Analysis 2003\Incidence - Histology
analysis"
*LAPTOP
*global thesisdata "D:\Thesis\Analysis 2003\Setup"
*global thesis "D:\Thesis\Analysis 2003\Incidence - Histology analysis"

Now to run a program on my laptop I would remove the * from the two LAPTOP
lines and add them to the two DESKTOP lines. 

I occurred to me that perhaps Stata could tell which computer it was running
on.  If that were the case, I could re-write my code above so that Stata
automatically assigned the correct macro.

I have found the c-class functions that store operating system information,
but there is nothing in these that is different between my two machines. 

Are there any undocumented c-class functions that could help, or does anyone
else have a different idea that might work.

Thanks, Kieran

__________________________________________________
Kieran McCaul
Senior Lecturer
Dept of Epidemiology and Biostatistics
School of Public Health
Curtin University of Technology
GPO Box U1987
Perth
Western Australia 6845

CRICOS provider code 00301J

email:  mailto:[email protected]
phone:  -61-8-9266-7045
fax:    -61-8-9266-2958
mobile: 0403 00 33 82
http://www.curtin.edu.au/curtin/dept/health/
__________________________________________________



*
*   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