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 ...
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 />
*open log file<br />
capture log close<br />
log using log_session2, append<br />
The Do-file editor window will open.<br />
2. Click on the yellow file folder tool and select the<br />
file session2.do<br />
3. Click on Open<br />
You can then re-execute these same commands or edit<br />
them as you wish.<br />
There are 2 icons on the tool bar: and . You can<br />
block lines in the do-file and click on either of these<br />
icons. The first icon (“Run Selected LInes”<br />
the commands you’ve blocked but in the Results<br />
) runs<br />
window you do not see the commands or any output from<br />
analysis. The second icon (“Do Selected Lines”<br />
runs the commands you’ve blocked and in the Results<br />
)<br />
window you can see which commands were run as well<br />
as the output from any analysis.<br />
Your <strong>SESSION</strong>2.DO should look similar to lines below;<br />
your documentation comments may not match exactly<br />
what has been included in this listing. Comments start<br />
with “/*” at the beginning of each comment and ending<br />
each comment with a */. You can also just use an “*” if<br />
the command is one line.<br />
/*<strong>STATA</strong> do file – section 2 – Cross-sectional Stata Tutorial<br />
Purpose: Calculate food production in calories per adult equivalent per day<br />
M Beaver - January 2009 */<br />
/* Tasks: 1) Compute total kgs produced, compute value of production in calories <strong>for</strong> specific food crops and<br />
aggregate to the household level to obtain total food calories produced<br />
2) Compute adult equivalents and aggregate to the household level<br />
3) Merge the two files and calculate food production in calories per adult equivalent per day<br />
4) Produce a table showing average food production in calories per adult<br />
equivalent in quartiles <strong>for</strong> each district */<br />
/* Stata recommends you include the version that the do file was written in */<br />
version <strong>11</strong><br />
clear all<br />
macro drop _all<br />
*modify next command to match the directory you are using<br />
cd "C:\Documents and Settings\aec_user\My Documents\StataTraining\data"<br />
* turn off "more" so the whole file will run<br />
set more off<br />
************************************<br />
*Step 1<br />
************************************<br />
82