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 ...
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 0 – File structure and Basic Operations <strong>for</strong> Stata <strong>11</strong><br />
SECTION 0 - File structure and Basic Operations <strong>for</strong> Stata <strong>11</strong> .............................................................................................. 5<br />
How Stata uses memory.......................................................................................................................................................... 6<br />
The set memory command.................................................................................................................................................. 6<br />
Increasing the amount of memory in the middle of a Stata session ...................................................................... 7<br />
The drop _all command ................................................................................................................................................... 8<br />
Types of files used by Stata and their extension names ............................................................................................... 8<br />
Data files ................................................................................................................................................................................. 8<br />
Log files ................................................................................................................................................................................... 8<br />
The log using command ....................................................................................................................................................... 8<br />
The cmdlog using command................................................................................................................................................ 9<br />
The log close command ........................................................................................................................................................ 9<br />
Do files..................................................................................................................................................................................... 9<br />
The doedit command ...................................................................................................................................................... 10<br />
Discussion of the <strong>Windows</strong> used in <strong>STATA</strong>....................................................................................................................... 10<br />
The Do-file Editor ............................................................................................................................................................... <strong>11</strong><br />
The Data Editor Window ................................................................................................................................................... 12<br />
The edit command........................................................................................................................................................... 12<br />
Saving the Stata Data File ................................................................................................................................................ 15<br />
The save, replace command......................................................................................................................................... 15<br />
The Brower Window........................................................................................................................................................... 16<br />
The browse command..................................................................................................................................................... 16<br />
The Stata Results Window................................................................................................................................................ 16<br />
The Command Window...................................................................................................................................................... 16<br />
The Viewer ........................................................................................................................................................................... 16<br />
Stata Graph window........................................................................................................................................................... 17<br />
Summary of the Basic File Types ....................................................................................................................................... 17<br />
SECTION 1 - Basic functions: Stata files, Descriptives and Data Trans<strong>for</strong>mations ............................................................ 18<br />
Introduction.............................................................................................................................................................................. 18<br />
Data files and the working file.............................................................................................................................................. 19<br />
Working Directory ................................................................................................................................................................ 19<br />
The cd command.............................................................................................................................................................. 19<br />
Opening a data file .............................................................................................................................................................. 20<br />
The use command............................................................................................................................................................ 20<br />
Describing the contents of a data file ............................................................................................................................. 21<br />
The describe command .................................................................................................................................................. 21<br />
Data storage types.............................................................................................................................................................. 23<br />
Display <strong>for</strong>mat...................................................................................................................................................................... 24<br />
Labels ..................................................................................................................................................................................... 24<br />
Documenting variables and labels...................................................................................................................................... 24<br />
The labelbook command................................................................................................................................................ 24<br />
–more–.................................................................................................................................................................................... 24<br />
The label list command.................................................................................................................................................. 25<br />
The codebook command................................................................................................................................................ 25<br />
Generating descriptive statistics........................................................................................................................................ 26<br />
Descriptive statististics - using one variable...................................................................................................................... 27<br />
Descriptives.......................................................................................................................................................................... 27<br />
The summarize command ............................................................................................................................................. 27<br />
In<strong>for</strong>mation returned by Stata commands....................................................................................................................... 29<br />
TABULATE - Frequencies.................................................................................................................................................. 30<br />
The tab1 command.......................................................................................................................................................... 31<br />
The histogram command ............................................................................................................................................... 31<br />
Saving a graph to a file...................................................................................................................................................... 31<br />
The list command ............................................................................................................................................................ 32<br />
Descriptive Statistics - using two or more variables..................................................................................................... 36<br />
Two-way Tables with Categorical Variables (Cross-tabulation)............................................................................. 36<br />
The tabulate command .................................................................................................................................................. 37<br />
Summary statistics on a continuous variable <strong>for</strong> each value in a categorical variable .................................. 39<br />
The by ... sort: summarize command........................................................................................................................ 39<br />
Data Trans<strong>for</strong>mations ............................................................................................................................................................ 41<br />
Converting continuous variables to categorical variables........................................................................................... 41<br />
The generate command ................................................................................................................................................. 41<br />
The replace command.................................................................................................................................................... 42<br />
The label variable command ........................................................................................................................................ 43<br />
The label define command............................................................................................................................................ 44<br />
The label values command............................................................................................................................................ 45<br />
3