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

st: Re: Cross-platform mobility

From (Alan Riley)
Subject   st: Re: Cross-platform mobility
Date   Mon, 22 Sep 2003 15:13:06 -0500

Danielle H. Ferry ( asked about paths on a shared
Windows/Mac hard drive:
> Not sure if there is a solution to this, but I figured I'd throw it out
> there. I have an external hard drive which I use on both a Mac (OS X) and a
> PC (Win XP). I write all my Stata work to this HD. I sometimes call datasets
> or do-files from directories other than the one in which I am working. In
> this case, it is necessary to list the full pathname. The problem is that
> the pathname is specified with ":" as separators (i.e.,
> on a Mac but with "\" on a PC
> (i.e., C:\bigdirectory\smallerdirectory\ Notice also, that a
> Mac indicates the hard drive name by putting a ":" in front of the pathname
> and a PC specifies the hard drive name by putting a ":\" after the hard
> drive name. Much thanks for any ideas!

I have a couple of suggestions which may help.

First, start using "/" as the directory separator when working in Stata
on either platform.  Under Windows, Stata will understand


and under OS X, Stata will understand


My second suggestion would be to create a macro containing the
operating system-specific portion of the path to the beginning
of the hard drive.  For example, in your for Stata for
Windows, you might put

   global HD "e:/"

and in your for Stata for Macintosh you might put

   global HD "/hd"

Then, you can work interactively on either platform or write do-files
on either platform which will work no matter whether you are using
the external drive with Windows or OS X.  This will work in either case:

   do $HD/bigdirectory/smallerdirectory/

*   For searches and help try:

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