Using Stata for Survey Data Analysis


Download 1.39 Mb.
Pdf ko'rish
bet44/61
Sana08.03.2023
Hajmi1.39 Mb.
#1252470
1   ...   40   41   42   43   44   45   46   47   ...   61
Bog'liq
2009 Usingstataforsurveydataanalysis (1)

Minot
 
 
 
 
 
Using Stata for Survey Analysis 
Page 40 
 

 
 Example 18. Using “collapse” to calculate the value of food consumption per household 
merge
This command combines two files with different variables into one file. Until now, all the commands 
we have worked with used just one file. However, the BLSS consists of many data files, and often we 
would like to combine data from different files. For example,
to calculate total expenditure, we would need to combine data from Block 8 (food 
consumption) and Block 9 (non-food consumption).
to see if food consumption patterns vary depending on the education level of the head of 
household, we need to combine data from Block 2.2 (education) and Block 8 (food 
consumption).
The merge command combines files horizontally (side to side). In this case, the two files have 
different variables and are linked by having the same observations (person, household, crop, etc.)
The files below have different variables but the same records (household). The command merge will 
combine records with the same household identification number (hhid). This would allow an analysis 
of how housing value (in the second file) varies according to expenditure level (in the first).
Two files before merge 
hhid region urban exppc quint farm
hhid housetype water elect value 
101 
101 
102 
102 
103 
103 
201 
201 
202 
202 
203 
║ 
║ 
▼ 
One file after merge 
hhid region urban exppc quint farm housetype water elect 
value 
101 
102 
103 
201 
202 
203 


Using Stata for Survey Data Analysis 

Download 1.39 Mb.

Do'stlaringiz bilan baham:
1   ...   40   41   42   43   44   45   46   47   ...   61




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling