Hello,
I have two data sets I would like to merge.
The first (main) one looks like this:
The second one looks like this:
What I would like to do is to merge each ID in the main data all the years in the second data, so each year would appear in a different row. So I would like finally to have:
How could this be achieved? I should mention both datasets contain additional variables I would like to merge similiarly.
Thank you,
Netanel
I have two data sets I would like to merge.
The first (main) one looks like this:
| Id | State |
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 2 |
| 5 | 2 |
| 6 | 3 |
The second one looks like this:
| State | Year |
| 1 | 1960 |
| 1 | 1962 |
| 2 | 1970 |
| 2 | 1974 |
| 2 | 1978 |
| 3 | 1960 |
| Id | State | Year |
| 1 | 1 | 1960 |
| 1 | 1 | 1962 |
| 2 | 1 | 1960 |
| 2 | 1 | 1962 |
| 3 | 1 | 1960 |
| 3 | 1 | 1962 |
| 4 | 2 | 1970 |
| 4 | 2 | 1974 |
| 4 | 2 | 1978 |
| 5 | 2 | 1970 |
| 5 | 2 | 1974 |
| 5 | 2 | 1978 |
| 6 | 3 | 1960 |
Thank you,
Netanel

Comment