Dear all,
I am facing some trouble merging 2 datasets in the following way:
dataset1: dataset2:
| x-variable | x-values | | y-variable | y-values |
---------------------------- ----------------------------
| x1 | 1 | | y1 | a |
| x2 | 2 | | y2 | b |
| x3 | 3 | | y3 | c |
merged into:
| x-variable | x-values | y-variable | y-values |
-----------------------------------------------------------
| x1 | 1 | y1 | a |
| x1 | 1 | y2 | b |
| x1 | 1 | y3 | c |
| x2 | 2 | y1 | a |
| x2 | 2 | y2 | b |
| x2 | 2 | y3 | c |
| x3 | 3 | y1 | a |
| x3 | 3 | y2 | b |
| x3 | 3 | y3 | c |
I do not really see how to do this since the merge command requires an id or some similar data that is present in both datasets whereas with append I cannot tell stata how to append the y-data to each x-observation.
Thank you for the help !
Regards,
Justine
I am facing some trouble merging 2 datasets in the following way:
dataset1: dataset2:
| x-variable | x-values | | y-variable | y-values |
---------------------------- ----------------------------
| x1 | 1 | | y1 | a |
| x2 | 2 | | y2 | b |
| x3 | 3 | | y3 | c |
merged into:
| x-variable | x-values | y-variable | y-values |
-----------------------------------------------------------
| x1 | 1 | y1 | a |
| x1 | 1 | y2 | b |
| x1 | 1 | y3 | c |
| x2 | 2 | y1 | a |
| x2 | 2 | y2 | b |
| x2 | 2 | y3 | c |
| x3 | 3 | y1 | a |
| x3 | 3 | y2 | b |
| x3 | 3 | y3 | c |
I do not really see how to do this since the merge command requires an id or some similar data that is present in both datasets whereas with append I cannot tell stata how to append the y-data to each x-observation.
Thank you for the help !
Regards,
Justine
Comment