10.04.2013 Views

STATA 11 for Windows SAMPLE SESSION - Food Security Group ...

STATA 11 for Windows SAMPLE SESSION - Food Security Group ...

STATA 11 for Windows SAMPLE SESSION - Food Security Group ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Stata <strong>11</strong> Sample Session Section 1 - Basic functions: Files, Descriptives, Data Trans<strong>for</strong>mations<br />

Data files and the working<br />

file<br />

Working Directory<br />

The cd command<br />

Open your Stata software. If you have not read or<br />

completed Section 0, please do so now to clarify the<br />

concept of the Command Window, the Review Window<br />

the Results Window, the Do-file Editor and the Viewer.<br />

Data from questionnaires that has been entered into Stata<br />

are stored in what are called data files. If we want to work<br />

with a set of data, we must open the corresponding data<br />

file so that it is available to the program.<br />

The working directory is the directory where your data<br />

files are stored. You can use the cd command to change<br />

to the directory where you have placed the data files you<br />

want to use.<br />

In the Command Window type:<br />

cd "name of working directory"<br />

Changing to the directory where the files are located<br />

eliminates the need to include the directory name in the<br />

do-file that we will be creating. If the directory you are<br />

changing to has spaces, the directory must be enclosed in<br />

quotes. Example of a directory name with spaces:<br />

“C:\Documents and Settings\My Documents\data”<br />

You can also set the working directory through the menus.<br />

From the menus select File, Change Working<br />

Directory. A dialog box opens in Browse mode. Find<br />

the directory that you want to work in and then click on<br />

Ok.<br />

In the Results window the cd command has been executed.<br />

We can copy that command to place it in our do-file so<br />

that if we share our do-file with another person, the<br />

command can be modified to fit the directory structure that<br />

person is using. Example:<br />

cd “C:\Documents and Settings\My<br />

Documents\StataTraining\data”<br />

When a data file is opened, it is loaded from the disk into<br />

memory (the computer's "RAM"), making it the working<br />

file. This means that the data from this file is now<br />

available <strong>for</strong> you to use. Let's start with the data <strong>for</strong> Table<br />

IA: Household Member Characteristics. The data file that<br />

19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!