Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72771

Merge different variables with same variable name

$
0
0
Halo everybody,

I'm trying to merge varios datasets using merge command. Datasets contain company-informations for year x. Unfortunately despite beeing sets of different years the names of variable are the same among datasets. E.g. EBIT, Margin_x etc.

What I'm loooking for is a way add the new data as a new variable without the overwriting the existing one, while ignoring the same fact, that both have the same name. Renaming of the variables manually is unfortunately not an option. Example:

Dataset a (1999):
company | EBIT
A | 123
B | 122
C | .

Dataset b (2000):
company | EBIT
A | 453
C | 980
D | 486

Goal:
company | EBIT_1 | EBIT_2
A | 123 | 453
B | 122 | .
C | . | 980
D | . | 486

As you can see some values may be missing. In the merge's help file there is a way to update the file but I couldn't find a way to simply out the data in a new variable.

Plese help


Viewing all articles
Browse latest Browse all 72771

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>