Announcement

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

  • Working Directory Keeps Changing by Itself

    I am brand new to Stata, though I regularly use R. I am on a Mac.

    I am trying to set my working directory to a folder on my desktop using cmd+shift+j. The console will repeat "/Users/brandonmorris/Desktop/WD".

    However, when I try to execute a .do file from that working directory, I get the error r(601).

    Double checking the working directory using the command "cd" results in the console telling me that the directory is "/Users/brandonmorris".

    Why does my working directory keep reverting back to "/Users/brandonmorris"? Is there a step here I'm missing? I've tried everything I can find on this forum. Thank you in advance for the help.

    -Brandon

  • #2
    As the help for cd states:
    Stata for Mac and Stata for Unix: cd (synonym chdir) changes the current working directory to directory_name or, if directory_name is not
    specified, the home directory. pwd displays the path of the current working directory.
    So when you are entering just cd , it is not merely telling you what the current directory is, it is also changing it to your home directory, /users/brandonmorris

    To know the current working directory, type pwd instead.

    Comment


    • #3
      cd stands for change directory and here is a Stata command. The same name with the same meaning was, and in a strong sense remains, used for a DOS command for PCs past and present and also is a long-standing command within Unix, Linux, and so forth.

      I guess you're thinking it means current directory.
      Last edited by Nick Cox; 16 Nov 2022, 02:49.

      Comment

      Working...
      X