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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

ca3 >60<br />

20. Click on the copy button, switch and paste in the dofile<br />

editor, switch back and click on Ok<br />

The label variable command<br />

The Stata commands created and run are:<br />

generate byte age_gp= 1 if ca3 >=0 & ca3 10 & ca3 19 & ca3 60<br />

(49 real changes made)<br />

Note that the Results window also shows how many<br />

observations were modified after each command was run.<br />

The next step is to verify that the changes were made<br />

correctly. Run the Tabulate command on the new variable.<br />

1. From the menus click on<br />

Statistics..<br />

Summaries, Tables & Tests<br />

Tables<br />

One-way tables<br />

The Tabulate1 - One-way Tables dialog box opens.<br />

2. For the Categorical Variables box, select the<br />

variable age_gp from the drop-down box.<br />

3. Click on the copy button, switch and paste in the dofile<br />

editor, switch back and click on the Ok button.<br />

The Stata command is:<br />

There should be 4 codes in the frequency table—1, 2, 3, and<br />

4. We can use the Data Browser to check to see what<br />

changes were made. Click on the Data Browser button.<br />

Close the window when you are finished.<br />

The values do not have any value labels to define what the<br />

values of 1, 2, 3, and 4 mean. We want to add both a<br />

variable label and give labels to the values in this variable.<br />

To assign a variable label:<br />

43<br />

tabulate age_gp

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

Saved successfully!

Ooh no, something went wrong!