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 3 – Tables and other Types of Analysis<br />

responses are requested, four variables must be used to<br />

code the responses. The set of possible responses are<br />

assigned sequential values and the same set of values are<br />

used <strong>for</strong> each of the 4 variables. The respondent must<br />

record a different value in each of the 4 variables. These<br />

types of variables are called multiple response variables.<br />

Question 35 in the household questionnaire is an example<br />

of a multiple response question. It asks about crops grown<br />

principally to be sold. Each household is asked to specify<br />

up to three main crops which are coded into variables<br />

h35a, h35b, and h35c. Codes are provided <strong>for</strong> five of the<br />

most common crops. The question is left open-ended,<br />

however, since a code of 6 is allowed <strong>for</strong> a crop not on the<br />

list. The name of the crop is written down on the<br />

questionnaire and later assigned a code.<br />

Because the question was open ended, more categories<br />

were added to these variables than what appears in the<br />

annex. After the data are collected, the researcher assigns a<br />

code to each of the crops specified <strong>for</strong> "6-other" - this<br />

procedure is called “post-coding”. Codes and value labels<br />

are entered into the data file and the data changed from the<br />

value of 6 to the appropriate code. As you will see, using<br />

the tab1 command, eleven different crops were specified<br />

<strong>for</strong> question 35.<br />

Stata does not have an official command that will tabulate<br />

data collected in this <strong>for</strong>mat. We can do frequencies of<br />

each variable or develop commands to pull out specific<br />

in<strong>for</strong>mation. There is a user-written “ado” command called<br />

tabw (Peter Sasieni, STB-25; Stata 3.1). For each variable<br />

in a list of 2 variables, this command will tabulate the<br />

number of times it takes on the values 0, 1, ..., 9; the<br />

number of times it is missing; and the number of times it is<br />

equal to some other value. String variables are not tabulated<br />

but are identified at the end of the displayed table. To<br />

download this ado file, connect to the Stata website.<br />

1. Click on Help then SJ and User Written<br />

Programs.<br />

2. In the Viewer click on STB<br />

3. Scroll down to stb25. and click.<br />

4. Click on sg36 ‘Tabulating the counts of multiple<br />

categorical variables”. In this screen, click on (click<br />

here to install)<br />

5. The program will be installed in the directory:<br />

C:\ado\plus\t<br />

6. To use the program, in the Command window type<br />

97<br />

tabw h35a h35b h35c

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

Saved successfully!

Ooh no, something went wrong!