Thanks it's helpful, we hope you would show us how tu use our single data from excel or from data stored out of stata for example... because this is the most used type I guess ! Thanks again (y)
Hi! Thank you for the comment. To solve this, you first import your file and then save it as a .dta (Stata format), and then you proceed as shown in the video :)
Thanks for your videos. I have a problem with merge I won't to merge 1:1 sam key variable . At all I have 7 dataset I like to merge. I get error says variable _merge already defined stata. How can we solve that problem?
@@SteffensClassroom okay but I will still keep the merge it variables? It's word drop that's scare me, 😅 it will not deleting the already mergeit variables?
@@alihussien7935 If you just only drop this one variable, then you are running into any trouble. Check out the keep/drop video if you need some additional help.
Hi Steffen, thanks a lot. I have a doubt. I have two datasets, one contains individual-level obs (var is idno) and the other has political parties as obs (string var is party). Both parties and individuals are nested in countries. The only var in common is indeed country, yet does not uniquely identify the obs. I would like to merge the two, by generating multiple obs for each idno in the master dataset corresponding to each idno-party pair in the same country. Unfortunately I'm stuck. Shall I create another variable to merge the two? Thanks a lot
I would assume that for instance you know which political party each individual belongs to, or at least something that can tie this all together. You would have to make a 1:m merge (see merge help file). Don't forget to change the string variable to numeric ( you can use encode here).
Stata automatically copy the original observation data when we do the 1:many. How make to NOT copy? Or, how to treat this additional observation (added after merging) as missing data?
Of I am not mistaken, you can use the _merge variable that is automatically created when using merge. You can then use a keep/drop command to only keep the observations you want. So of you o ly want to keep the observations that appear in both datasets, you use keep if _merge==3. I hope this helps!
Thanks it's helpful, we hope you would show us how tu use our single data from excel or from data stored out of stata for example... because this is the most used type I guess ! Thanks again (y)
Hi! Thank you for the comment. To solve this, you first import your file and then save it as a .dta (Stata format), and then you proceed as shown in the video :)
Thanks from France ! it has been useful !
Happy that is helped!
helps a lot! Thank you!
Thanks for your videos.
I have a problem with merge I won't to merge 1:1 sam key variable . At all I have 7 dataset I like to merge. I get error says variable _merge already defined stata. How can we solve that problem?
After each separate merge, you need to drop the _merge variable that is automatically generated.
@@SteffensClassroom okay but I will still keep the merge it variables? It's word drop that's scare me, 😅 it will not deleting the already mergeit variables?
@@alihussien7935
If you just only drop this one variable, then you are running into any trouble. Check out the keep/drop video if you need some additional help.
@@SteffensClassroom okay I will do, thanks a lot for your kindness and help
its very much helpful. thanks
Thanks. It's really helpful
Hi Steffen, thanks a lot. I have a doubt. I have two datasets, one contains individual-level obs (var is idno) and the other has political parties as obs (string var is party). Both parties and individuals are nested in countries. The only var in common is indeed country, yet does not uniquely identify the obs. I would like to merge the two, by generating multiple obs for each idno in the master dataset corresponding to each idno-party pair in the same country. Unfortunately I'm stuck. Shall I create another variable to merge the two? Thanks a lot
I would assume that for instance you know which political party each individual belongs to, or at least something that can tie this all together. You would have to make a 1:m merge (see merge help file). Don't forget to change the string variable to numeric ( you can use encode here).
@@SteffensClassroom Thanks a lot!
Stata automatically copy the original observation data when we do the 1:many. How make to NOT copy? Or, how to treat this additional observation (added after merging) as missing data?
Of I am not mistaken, you can use the _merge variable that is automatically created when using merge. You can then use a keep/drop command to only keep the observations you want. So of you o ly want to keep the observations that appear in both datasets, you use keep if _merge==3.
I hope this helps!
Thanks a lot.
You're welcome!