Hi, I have a data set in a structure similar to the following (tall format): id score 100 10 100 13 100 16 100 19 101 13 101 14 101 15 101 16 103 20 103 22 103 24 103 26 I want to add a time variable so that the new data set appears as below: id score time 100 10 1 100 13 2 100 16 3 100 19 4 101 13 1 101 14 2 101 15 3 101 16 4 103 20 1 103 22 2 103 24 3 103 26 4 Here is my attempt, but it doesn't produce the expected output, and I'm not sure why. -------------------- data test; input id score; datalines; 100 10 100 13 100 16 100 19 101 13 101 14 101 15 101 16 103 20 103 22 103 24 103 26 ; run; data test2; set test; do i=1 to 3; do j=1 to 4; time=j; output; end; end; keep id score time; run; -------------------- I am new to SAS, so any help would be greatly appreciated. Thanks in advance!
... View more