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 ...
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 />
Indicator variables<br />
[type_of_weight=variable_in_file].<br />
Let’s use one of the Stata’s sample data files to explore this subcommand.<br />
1. Click on File then Open A dialog box should open<br />
telling you that the data have changed and do you want<br />
to continue and lose unsaved data. We don’t want to<br />
save any changes to the data file, click on Yes<br />
2. Select census.dta.<br />
3. Click on Ok. - Remember to copy the command and<br />
paste it into the do-file editor.<br />
Use the Browse button to look at the data. There is one<br />
observation <strong>for</strong> each state. The variable called pop is the total<br />
population <strong>for</strong> the state. The variable called medage is the<br />
median age of the population. First let’s get the populationweighted<br />
mean.<br />
1. From the Statistics menu select Summaries, tables<br />
& tests then Summary and descriptive statistics<br />
then Summary statistics<br />
The Summarize - Summary Statistics dialog box opens.<br />
2. Select medage in the “variables” box.<br />
3. Click on the “weights” tab.<br />
Note that only 3 types of weights are available to<br />
choose from. There is also a help button on weights.<br />
4. Select Analytic weights<br />
5. Click on the copy button, switch to the do-file editor,<br />
paste the command, switch back to the dialog box and<br />
click on Submit.<br />
Look at the output. The sum of the weight is 225,907,472.<br />
This is the population of the U.S. in the 1980 census. The<br />
weighted mean is 30.<strong>11</strong>. Now, return to the dialog box.<br />
6. Click on None under the Weight tab.<br />
7. Click on the copy button, switch to the do-file editor,<br />
paste the command, switch back to the dialog box and<br />
click on Ok<br />
The unweighted mean is 29.54. The Stata commands are:<br />
use "census.dta", clear<br />
summarize medage [aweight=pop]<br />
summarize medage<br />
Survey weights are discussed in the next section.<br />
An indicator variable is a special case of a categorical variable.<br />
An indicator variable has two groups only, whereas other<br />
categorical variables can have more than two groups. Usually<br />
99