i have this data,
2001 WALKING AEROBICS TENNIS
2002 FOOTBALL BASKETBALL TENNIS
2003 AEROBICS SWIMMING CYCLING
and i need to convert it to like this, how?
Obs Id Pref Sports
1 2001 1 WALKING
2 2001 2 AEROBICS
3 2001 3 TENNIS
4 2002 1 FOOTBALL
5 2002 2 BASKETBA
6 2002 3 TENNIS
7 2003 1 AEROBICS
8 2003 2 SWIMMING
9 2003 3 CYCLING
is it something to do with looping, arrays or proc transpose?.
please show me code. Thanks