stata-how to join a new variables to the data set

momo

New Member
#1
Hi, all of you

I have a data set with more than 30000 observations and I need to join new variables to the old variables.
and what if some observations are missing comparing with the old data set.

thanks for help
 
#2
Hey there,

I'm not sure that I understand what you mean by "some obervations are missing comparing with the old data set". Anyway, start with the dataset that has the largest number of observations and use the command "merge" together with the option "update"

Hope this helps

Etienne
 
#3
as Etienne mentioned you should just merge the file that contains the new variable.
If the common field is for example id
the syntax is: merge id using 2nd_file, update
notice that both files need to be sorted by id for this to work.

after the merge it's bet to run tab _merge to see the fit of observations.