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 2 – Restructuring Data Files – Table Lookup & Aggregation<br />

Step 2: Generate a household<br />

level file containing the<br />

number of adult equivalents<br />

per household.<br />

5. Run the describe command again.<br />

The Stata commands are:<br />

describe<br />

label variable cprod_tt "Calories produced in staple<br />

foods"<br />

describe<br />

The new working data file now contains what we need,<br />

total number of calories from staple foods produced per<br />

household. We can also look at this variable by doing a<br />

descriptives. Use the “summarize” command to run a<br />

mean on the new variable cprod_tt. You should find<br />

that the average number of calories produced per<br />

household per year is 4,483,965.<br />

Save this data file using the Save As... command.<br />

1. Use Save As... from the File menu<br />

2. Name the file hh-file1<br />

3. Click on Save.<br />

4. Copy the command from the Results window<br />

and paste it into the do-file editor, delete the<br />

reference to the directory, and add a comment to<br />

explain what you have done.<br />

Remember to save your do-file regularly. You must be in<br />

the Do-file editor to save the do-file.<br />

The data needed to calculate adult equivalents per<br />

household is in the member file, C-Q1A.DTA.<br />

1. Click on the “Open Folder” button on the Stata<br />

Taskbar<br />

2. Select the file name c-q1a.dta and open the file.<br />

3. Copy the command and paste it into the do-file<br />

editor, delete the directory reference, and add a<br />

comment to explain what you have done.<br />

The adult equivalent value says that, on average, a female<br />

10 to 19 years old needs only 84% as many calories as a<br />

male 10 years or older, and that children under 10 need<br />

only 60% as many calories as the typical male 10 years<br />

and older. Thus, <strong>for</strong> example, a child (male or female)<br />

under age 10 is counted as .60 adult equivalents. For<br />

each person (observation) in the member file we need to<br />

look at the variables sex, ca4, and age, ca3, to calculate<br />

adult equivalents.<br />

The rules we will use <strong>for</strong> calculating adult equivalents <strong>for</strong><br />

66

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

Saved successfully!

Ooh no, something went wrong!