Introductory Stata 12: Combine Datasets (append, merge)

preview_player
Показать описание
In this video, we will examine how to combine datasets. There are two types of combinations. One is "Appending," and the other is "Merging." Appending adds observations to existing variables. Merging datasets is different. It adds new variables to existing observations.

capture log close

*append datasets
clear
input id number
1 1
2 3
3 5
end
list

clear
input id number
4 2
5 4
6 6
end
list

list

*merge datasets
clear

input id income
1 200
2 450
3 120
4 350
5 110
end
list

clear
input id age
1 23
2 43
3 45
4 32
5 35
6 21
end
list

help merge

list

list, nolabel

log close

#merge #append #Stata
Рекомендации по теме