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 Annex I I– Survey Instrument<br />

Annexes<br />

ANNEX I – Stata Commands<br />

This annex provides a brief reference guide and to explain the various functions of the Stata commands<br />

most commonly used. This annex was developed by Ellen Payongayong. The commands in the table<br />

below do not contain the full Stata syntax.<br />

Note that commands can be abbreviated. In the Help Syntax Viewer, the syntax explanation will show<br />

how much of the command must be typed, e.g. “Summarize” can be shortened to “su” or “sum”. In<br />

this Help viewer, the letters that are required <strong>for</strong> the command are underlined.<br />

Command Description<br />

pwd tells you which directory you’re in<br />

cd {c | d | e...): cd c: changes drives to c drive<br />

cd .. changes directory one level higher<br />

cd (path) changes current directory to that specified in path<br />

cd\ takes you to the root directory<br />

dir lists contents of current directory<br />

use filename1 loads file into memory<br />

save filename2 saves current file in memory into filename1. if filename already<br />

exists, stata will not let you overwrite it<br />

save filename2, replace saves current file in memory into filename2, overwriting any file<br />

in working directory that is currently named filename2<br />

save, replace saves current file in memory into filename of that which is<br />

currently in memory<br />

edit brings up the data editor<br />

browse brings up the same data “editor’’ as in edit, but will not allow<br />

you to change data<br />

describe gives a description of the data file: number of observations,<br />

number of variables, list of variables, variable type and width,<br />

variable labels (if any)<br />

summarize gives basic summary statistics: number of valid observations,<br />

mean, standard deviation, minimum value and maximum value<br />

list lists observations<br />

keep retains in memory only those variables or cases specified<br />

drop discards from memory all variables or cases specified<br />

tabulate generates one- and two-way frequency tables<br />

tab1 generates one-way table <strong>for</strong> each variable specified after the<br />

command.<br />

log using filename saves all commands and related output into specified file. the<br />

default <strong>for</strong>mat is SMCL <strong>for</strong> Stata Markup and Control Language.<br />

file is given extension .smcl<br />

log using filename, text saves all commands and related output into an ASCII file with<br />

extension .txt.<br />

log { off | on | close} off temporarily suspends the log file (switches it “off”); on<br />

switches the log “on” and close closes the log file<br />

log using filename, append adds subsequent commands to an existing log<br />

<strong>11</strong>3

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

Saved successfully!

Ooh no, something went wrong!