Stata help: merge variable from other files

my data is in panel. countrycode year AFG 1990 .. 1991 .. 1992 .. .. BAN 1990 .. 1991 .. 1992

Now I would like merge a excel file which is consisting income based classification of countries: countrycode AFG Low income BAN Low middle income ANG Low middle income IND Low middle income BAH High income

How can I add this to the previous main file ?

I used merge m:m Country using "C:\Users\Dell\Downloads\merge file.dta" keep if _merge==3 drop _merge

But it mixed up the year and destroyed the organization or serial of the year like: countrycode year AFG 1992 .. 1990 .. 1991 .. .. BAN 1991 .. 1990 .. 1992

You seem to be asking about how to process data with Stata. This forum is not a good place to ask that because it supports users of R.
If you are asking about how to process your data in R, please post examples of your data. You can do that by posting the output of the dput() function. If your data frame is named DF, run the command

dput(head(DF, 20))

copy the output and paste it into a forum response, placing a line with three back ticks just before and after the output, like this:
Pasted output from dput() goes here
Do this for both data sets.

Okay thank you for your response!

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.