Dear Statalist,
In my current job I used multiple computers to do my Stata work from multiple offices. Most of the computers are MACs, but one of them is a PC.
As a result, each time I move locations to do work I need to always SLIGHTLY change the directory from which I am pulling data files into Stata in my do file programs.
Here is an example. I start all my do files generally like this on a PC:
But sometimes I am working on this file from the following place (from a mac):
Each time then I have to by hand change the file path that I'm working from and that's getting a bit tedious!
I tried this, assuming capture would force the program to keep going until it hit the directory that worked on the machine I was on at the moment:
This isn't working, though.
Does anyone else have a trick I could use? Thanks so much for your help!
In my current job I used multiple computers to do my Stata work from multiple offices. Most of the computers are MACs, but one of them is a PC.
As a result, each time I move locations to do work I need to always SLIGHTLY change the directory from which I am pulling data files into Stata in my do file programs.
Here is an example. I start all my do files generally like this on a PC:
Code:
clear set more off global myfiles "c:\Users\rnb16003\filepath to stata files" cd "$myfiles" import excel using "$myfiles\name_of_file.xls"
Code:
clear set more off global myfiles "/Users/mac_username/filepath to stata file" cd "$myfiles" import excel using "$myfiles/name_of_file.xls"
I tried this, assuming capture would force the program to keep going until it hit the directory that worked on the machine I was on at the moment:
Code:
clear set more off capture global myfiles "c:\Users\rnb16003\filepath to stata files" capture global myfiles "/Users/mac_username/filepath to stata file" cd "$myfiles" capture import excel using "$myfiles\name_of_file.xls" capture import excel using "$myfiles/name_of_file.xls"
Does anyone else have a trick I could use? Thanks so much for your help!
Comment