Hi all!
Hoping a kind person can help a complete beginner, me, with the merge of two datasets when wanting to use data of different years in each set.
The two datasets are "qog_std_ts_jan22" and "qog_ei_sept21". Both datasets have country level data with data for several years each.
I have succesfully merged the two sets using "merge 1:1 cname year using qog_ei_sept21".
However, when trying to drop the observations for the years I am not interested in, using "keep if _merge==1 & year ==2008" and "keep if _merge ==2 & year ==2005", the dataset gets completely wiped. However, i know that there are values for the years 2005 and 2008 respectively. Does the issue lie in merging the sets based on year, and if so, how would i work around this (only merging based on name does not work as each country has multiple observations.
Thank you in advance for any help and apologies if this is very common knowledge, as mentioned I am completely new to Stata and statistical software in genaral.
Hoping a kind person can help a complete beginner, me, with the merge of two datasets when wanting to use data of different years in each set.
The two datasets are "qog_std_ts_jan22" and "qog_ei_sept21". Both datasets have country level data with data for several years each.
I have succesfully merged the two sets using "merge 1:1 cname year using qog_ei_sept21".
However, when trying to drop the observations for the years I am not interested in, using "keep if _merge==1 & year ==2008" and "keep if _merge ==2 & year ==2005", the dataset gets completely wiped. However, i know that there are values for the years 2005 and 2008 respectively. Does the issue lie in merging the sets based on year, and if so, how would i work around this (only merging based on name does not work as each country has multiple observations.
Thank you in advance for any help and apologies if this is very common knowledge, as mentioned I am completely new to Stata and statistical software in genaral.
Comment