Introduction to Stata

3. Defining the working folder

Before doing anything with an open Stata file, you should always define the location of your working folder.  Your ‘working folder’ is a folder on (one of) your drives where you keep all of your data for a particular project or piece of analysis.

If you have never been so organised with your data sets, now is an excellent time to start!  There’s really not a whole lot worse than doing a bunch of analyses using multiple datasets and having the files all jumbled in with other documents … or worse, spread all over the place in separate folders!


There are two key commands for defining and checking your working folder:

Table 1


We are now going to define our own working folder, which will be our USB drive location.  Now would be a perfect time to get out your USB stick, plug it in, and then open windows explorer to determine the file path for your USB.


task  Task:   Define and check your working folder

Make sure you know where you’d like to keep the data files (and other related documents) for this workshop.   You might choose to create a new folder on your USB drive for this purpose (this would be our strong recommendation!).


Use the cd command to define your working folder location, e.g.,:

. cd "E:\Stata_workshop"


You can then check the current working folder using the pwd command:

. pwd