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 />

were tabulated. Why?<br />

The tab1 command The Stata commands are:<br />

The histogram command The Stata command is:<br />

1. Go back to the dialog box, Tab1 - One-way Tables.<br />

2. There is an option “Treat missing values like<br />

other values”. Place a tick mark ✓ on this option.<br />

3. Copy the command, switch to the do-file, copy the<br />

command, return to the dialog box.<br />

4. Click on Ok<br />

Looking at the table <strong>for</strong> ca4 – there are 16 cases that are<br />

missing values. Stata’s default is to not show the missing<br />

values.<br />

tab1 ca1 ca2 ca4 ca5 ca6<br />

tab1 ca1 ca2 ca4 ca5 ca6, missing<br />

Note: to produce a tabulation (frequency) of just one<br />

variable, you can use the tabulate command. However, if<br />

you want to list several variables in the frequency<br />

command, you must use the tab1 command. Below, you<br />

will see that if you use the tabulate command and list 2<br />

variables, a cross-tabulation is produced.<br />

Another useful way to examine a continuous variable is<br />

to Graph the variable to view the distribution of the<br />

values.<br />

1. From the menus select Graphics, Histogram<br />

2. Click on the drop-down area <strong>for</strong> the Variables<br />

box and select ca3.<br />

3. Tick the box ✓ <strong>for</strong> Width of bins and type in 5<br />

in the box next to this option. The ages will be<br />

grouped into 5 year ranges.<br />

4. For the Y-axis click on the radio button next to<br />

“Frequency” so we will see the number of cases in<br />

the age groups.<br />

5. Click the copy icon and then click on Ok to run<br />

the command.<br />

histogram ca3, width(5) frequency<br />

See a copy of the graph below.<br />

Saving a graph to a file If you want to save this graph to a word processing<br />

document, you can on the graph, select<br />

“copy graph”, then switch to your word processor and<br />

31

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

Saved successfully!

Ooh no, something went wrong!