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

Command Description<br />

assert assert verifies that an expression is true. if it is, the command<br />

produces no output; if it is not, assert in<strong>for</strong>ms you that the<br />

"assertion is false".<br />

append using append appends a <strong>STATA</strong>-<strong>for</strong>mat dataset stored on disk to the<br />

mvencode varlist, mv (#),<br />

[override]<br />

end of the dataset in memory.<br />

changes all occurrences of missing to # in the variable listing<br />

specified.<br />

override specifies the protection provided by mvencode is to be<br />

overridden. without this option, mvencode refuses to make the<br />

requested change if # is already used in the data.<br />

mvdecode varlist, mv (#) changes all occurrences of # to missing in the variable list<br />

egen<br />

creates a new variable equal to the specified functions and its<br />

arguments<br />

regress depvar varlist regress estimates a model of the dependent variable on variables<br />

in varlist<br />

xi: regress ....i.variable constructs categorical dummy variables <strong>for</strong> variables omitting<br />

the first category.<br />

predict variable stores the predicted values from the regression in variable. what<br />

this command can do is determined by the previous command.<br />

probit probit estimates maximum-likelihood probit models.<br />

search searches the keyword database. Use search when you are not<br />

certain of the command, e.g., search string shows all commands<br />

associated with strings.<br />

tables calculates and displays tables of statistics.<br />

reshape converts data from wide to long <strong>for</strong>m and vice versa. ‘wide’ and<br />

‘long’ refer to how data are organized. See reshape notes<br />

below.<br />

fillin varlist adds observations with missing data so that all combinations of<br />

varlist exist, thus rectangularizing the file. the variable _fillin is<br />

added to the data. _fillin is 1 <strong>for</strong> created observations and<br />

0 <strong>for</strong> previously existing observations.<br />

(svy commands) these are commands prefixed with ‘svy’ and they pertain to<br />

commands used in analyzing survey data.<br />

tables calculates and displays tables of statistics.<br />

<strong>for</strong>mat varlist %fmt <strong>for</strong>mats numeric variables as follows--number be<strong>for</strong>e the<br />

decimal indicates the length of the variable, number after the<br />

decimal indicates number of decimal places:<br />

%#.#g - general numeric <strong>for</strong>mat (%5.0g)<br />

%#.#f - fixed numeric <strong>for</strong>mat (e.g., %5.2f)<br />

%#.#e -base 10 power<br />

strings are <strong>for</strong>matted as follows and can be 81 chars long:<br />

%#s (e.g., %10s)<br />

Reshape notes: The reshape command is particularly useful <strong>for</strong> files such as that shown in the following<br />

example:<br />

Households were asked about the number of livestock owned <strong>for</strong> three types of livestock coded 330, 331<br />

and 335. To save on data entry time, only those entries reporting any livestock were entered. Missing<br />

livestock codes in the file there<strong>for</strong>e means that the household did not own the livestock associated with<br />

the code. The file looks like this.<br />

<strong>11</strong>5

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

Saved successfully!

Ooh no, something went wrong!