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 1 - Basic functions: Files, Descriptives, Data Trans<strong>for</strong>mations<br />

variable in the Generate Variable box:<br />

agecat<br />

5. Click on the Generate variable as type drop down<br />

box and change to byte.<br />

6. For the Contents box, click on the Create button.<br />

7. In the Expression builder box, under the<br />

Category section, select Programming<br />

8. A list of available functions is displayed. Scroll<br />

down to the recode() function and highlight that<br />

function. You will see a description of the function<br />

at the bottom of the dialog box.<br />

9. Double click on this function. The function will be<br />

pasted in the window at the top of the dialog box so<br />

that you see:<br />

recode(x,x1,x2,...,xn)<br />

The first “x” is highlighted. Replace the first “x”<br />

with the variable name, ca3, so that the expression<br />

now looks like:<br />

recode(ca3,x1,x2,...,xn)<br />

Replace the “x1" with the value of the highest age<br />

that you want to recoded <strong>for</strong> the first group, e.g.<br />

recode(ca3,10,x2,...,xn)<br />

Continue replacing the values with the next group<br />

to be coded until all groups are defined, e.g..<br />

recode(ca3,10,19,60,100)<br />

Stata will use the value as the code assigned to<br />

all cases that fall within that group. The value<br />

of 10 will be assigned to all observations with<br />

ages between 0 and 10, the value of 19 will be<br />

assigned to all observations that fall between ca3<br />

>10 and

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

Saved successfully!

Ooh no, something went wrong!