Minot
Using Stata for Survey Analysis
Page 44
then the average will include the zeroes. This is an extremely useful command, particularly for
dealing with food consumption, expenditure, and crop production data. SPSS does not have a similar
command.
reshape
The command changes a file from tall to wide or from wide to tall. What do we mean by “wide” and
“tall”? A wide file stores additional information as separate variables, while a tall file stores this
information using additional records. An example will be easier to understand. Food expenditure
data includes different types of foods and the value of expenditure on each. One way to store this data
is with a wide file, in which additional loans are stored in additional variables.
File in “wide” format
hhid
food1
value1
food2
value2
food3
value3
1
2
3
4
5
The other way to store the data is with a tall file, in which each food item is stored as separate
observation.
File in “tall” format
hhid
food
value
1
1
1
2
1
3
2
1
2
2
2
3
3
1
3
2
3
3
4
1
4
2
4
3
5
1
5
2
5
3
Notice that both files have the same number of data points (30) for food type and value, they are just
arranged differently. The reshape command allows you to convert one type of file into the other. For
more information, type “help reshape” in the Stata Command window. For information on how to
implement reshape, type “help reshape.”
Do'stlaringiz bilan baham: |