Setting the working directory
Download
Key points
- 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.
- 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.
- 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"
. - Run the command to set the working directory by selecting it and using the "Execute selection" button or the shortcut Ctrl + D.
- 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
.