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

st: Re: moving between Mac and Windows

From   Christopher F Baum <>
Subject   st: Re: moving between Mac and Windows
Date   Tue, 23 Sep 2003 07:04:37 -0400

On Tuesday, September 23, 2003, at 02:33 AM, Michael wrote:

you might be able to attack you problem by code like this:

early in you do file, define the drive:

local drive=cond("$S_OS"=="Windows","C:",":C")

..then later code:

use `drive'`c(dirsep)'stata`c(dirsep)'auto, clear
As Alan points out, changing dirsep is not necessary (nor desirable). The colon separator is left over from pre-OS X Macs. OS X Macs are Unix machines, so you can always refer to a directory with forward slashes, e.g. /Applications/Stata/auto.dta will refer to the Stata home directory:

[Blackbird:~] baum% ls -l /Applications/Stata/auto.dta
-rw-r--r-- 1 root wheel 5323 Dec 22 2002 /Applications/Stata/auto.dta

Indeed, the external hard drive may be referred to as a Unix filesystem under OS X, as in this example using my iPod as an external HD:

[Blackbird:~] baum% ls -l "/Volumes/Kit Baum's iPod/auto.dta"
-rw-r--r-- 1 baum unknown 5323 Dec 22 2002 /Volumes/Kit Baum's iPod/auto.dta

(Quoting the filename is necessary since the iPod's name contains spaces)

Since accessing Windows files within Stata will also work with the forward slash (rather than the DOS backslash), the directory separator is not the issue; only the hard disk name must be tweaked between systems. If the hard disk name does not contain embedded spaces, this will be simpler, as Michael shows above.


* For searches and help try:

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