Created
April 11, 2012 20:23
-
-
Save anonymous/2362203 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* If there are three users working with the same do-file but storing their work in different directories on their local machines, | |
* use the following code to change to the project folder: *** | |
capture cd "C:/Documents and Settings/User_1/Working/Paper2/final_folder/" | |
capture cd "D:/Documents and Settings/User_2/final_folder/" | |
capture cd "Z:/Documents and Settings/User_3/Project2/final_folder/" | |
*** The capture command will check whether the directory on the first line exists. If it does, it will make it the current directory. | |
*** If the directory does not exist, Stata will check whether the second one exists, and so. The role of -- capture -- here is to | |
*** prevent Stata from halting when it encounters an error (i.e. a non-existing directory, in this case). | |
* If the only difference in the paths used by the three users is the username, then it is possible to replace the above code with: | |
cd "C:/Documents and Settings/`c(username)'/final_folder/" | |
*** Note: the `c(username)' captures the system username of the user. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment