Setting the working directory

Key points

  1. It is good practice to set the folder containing the dataset as the working directory in Stata, as it makes opening files more straightforward and easier using commands.
  2. To find the path to the folder containing the dataset, open Microsoft File Explorer and click on the address bar to reveal the full path. Right-click and copy the path.
  3. To set the working directory, use the command cd followed by the full path of the folder in double quotes. For example, cd "C:\Users\Name\Documents\StataFolder".
  4. Run the command to set the working directory by selecting it and using the "Execute selection" button or the shortcut Ctrl + D.
  5. To open a file from the working directory, type the command use followed by the name of the dataset to open it, for example, use dataset.


Complete and Continue