Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change default working directory (Windows and Mac)

    I cannot find a way to change the initial working directory after Stata has been installed.

    The PDF manual says you can run set up again, but I tried that and it did not prompt me to enter/change the directory.

    I understand I can use a profile.do file in the directory to change it, but for students this is problem. Further, some of my students using Macs do not have write permission on the directory they chose when they installed it, so even this workaround is problematic.

    Nothing about this appears when I search in the vast Stata universe. I did learn from this list that
    display "`:environment HOMEPATH'" will display the initial working directory. So the questions is, can the value of HOMEPATH be changed (Windows and Mac)?

  • #2
    Perhaps an easy alternative is to select the Stata preference labelled "Start in the last session's current working directory". Then once the user changes the working directory to the appropriate directory (from within Stata), when she or he restarts Stata it will start in that directory. I find that an effective way of working; I keep different projects in different directories.

    Comment


    • #3
      Originally posted by William Lisowski View Post
      Perhaps an easy alternative is to select the Stata preference labelled "Start in the last session's current working directory". Then once the user changes the working directory to the appropriate directory (from within Stata), when she or he restarts Stata it will start in that directory. I find that an effective way of working; I keep different projects in different directories.
      Sorry, I don't understand this suggestion. I do not see any "Start in the last sessions current working directory" option.

      Comment


      • #4
        Using Stata/SE 13.1 for Mac, from the Stata menu I choose General Preferences. In the window that opens, I choose the General tab. The third item listed is the option in question. I believe that on Stata/SE 13.1 for Windows, the Edit menu contains the General Preferences item. I also believe this advice holds true for Release 14.

        Comment


        • #5
          The reinstall option applies to Windows and offers the old style start in directory option C:\data or the newer C:\Users\<username>\Documents option.

          User level profile.do is also supported without privilege escalation. On the Mac, students can create a profile.do in ~/Library/Application Support/Stata (where ~ denotes the user's home directory). Windows users have similar functionality by creating a profile.do in C:\Users\<username>\Documents. As William notes above, the last session option is for OSX only, but on the Windows side users can edit the Stata14 launcher for added functionality. Simply right click on the icon used to launch Stata and select Properties. The target box should read "C:\Program Files (x86)\Stata14\StataMP-64.exe" /UseRegistryStartin or similar, but you should also notice a Start in field directly below that. If /UseRegistryStartin is removed from the Target, the Start in field can be populated with your path of preference and respects Windows environment variables. Thus, the entry %USERPROFILE%/stata14 would be interpreted as C:\Users\<username>\stata14.

          NOTE: On the Windows side, make sure the directory exists before editing the launcher.

          Comment


          • #6
            I am installing Stata 13 on a Windows 10 machine. I wasn't paying attention the first time, and realized subsequently that I want to change the default working directory. I have now tried reinstalling, reinstalling after an uninstall, reinstalling after an uninstall with a third-party product which also removes registry keys related to Stata, all without success. Even though I can specify a different default working directory during setup, the HOMEPATH continues to show the original default working directory. I know from this thread that I can use profile.do to change the working directory, but I'd like to keep profile.do in the default working directory. Pete's suggestion to right-click on the start-menu launcher doesn't work for me (perhaps because I don't understand Windows 10 well enough); it does not give me a link to the properties item for Stata.

            Thanks for any help.

            Devra
            Devra Golbe
            Professor Emerita, Dept. of Economics
            Hunter College, CUNY

            Comment

            Working...
            X