Hello everyone,

I am trying to make below two dataset merged, but don't know how to make the format.

The final step I should do is comparing each individual's wage in each year from 1981 to 1999 (data1) with each year's public median wage(data2).

To do so, I have to combine people's wage information in each year and median wage information into one dataset.

However, I don't have much clue how to combilne these datasets which have different formats.


Data1

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte PID int(year1981 year1982 year1983 year1984 year1985 year1986 year1987 year1988 year1989 year1990 year1991 year1992 year1993 year1994 year1995 year1996 year1997 year1998 year1999)
21 100 100 100 100 100  50  50  50  50   0   0 150 150 150 150 150 150 150 150
22 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160 160
41   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
42 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400
51 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420 420
52 205 205 205 205 205 205 205 205 205 205 205 205 205 205 205 205 205 205 205
61 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 350 100 100
62   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
71 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250   0
end

Data2

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str9 year double medi_wage
"medi_1981" 155.0617
"medi_1982"  185.158
"medi_1983"  210.667
"medi_1984"  231.525
"medi_1985"  248.425
"medi_1986"      275
"medi_1987"      300
"medi_1988"  359.417
"medi_1989"  433.625
"medi_1990"  514.742
"medi_1991"  620.108
"medi_1992"  757.917
"medi_1993"  843.417
"medi_1994"  940.833
"medi_1995"  1065.25
"medi_1996" 1188.833
"medi_1997"   1310.5
"medi_1998"   1322.5
"medi_1999" 1361.167
end

Thank you very much for your help.
Halim.