Hi Statalist,

I am a beginner user of Stata. I am trying to write some loop syntax and change the data structure of a multiple response question Q3 (1=yes) to a new structure (new variables: response_1 to response_5) which represent the 1st, 2nd, 3rd, 4th response of Q3. I have tried many ways, but no success. Can you help please? Many thanks!
respondentid q3_1 q3_2 q3_3 q3_4 q3_5 response1 response2 response3 response4
11860218774 1 1
11860219457 1 1 2 4
11860219561 1 1 1 1 1 3 4 5
11860219588 1 1
11860219895 1 2
11860219926 1 3
11860220059 1 2
11860220088 1 1 1 4
11860220114 1 2
11860220144 1 1 1 4
Regards,

Danny Tu