I have a dataset that has Id, Quest(these are the question no.) and some text for each of the question. I would like to transpose data so that certain combination of question and text would be per case.
Instead of explaining I will just give input and the desire output.
Input Dataset:
ID Quest Text
1111 C2_1 abcd
1111 C2_2 eeee
1111 C2_3 ffff
1111 C3_1 gggg
1111 C3_2 xyzh
1111 C3_3 mmmm
1111 D4_1 efgh
1111 D4_2 lmno
1111 D4_3 kkkk
1111 D5_1 txyz
1111 D5_2 klmn
1111 D5_3 ctyx
Desired Output should be:
ID QuestInd TextInd QuestOcc TextOcc
1111 C3_1 gggg C2_1 abcd
1111 C3_2 xyzh C2_2 eeee
1111 C3_3 mmmm C2_3 ffff
1111 D5_1 txyz D4_1 efgh
1111 D5_2 klmn D4_2 lmno
1111 D5_3 ctyx D4_3 kkkk
I tried using retain, .first, creating separte data set and remerging.. etc. etc.. nothing seems to be working -
any help will be appriciated.
thanks SK.
Instead of explaining I will just give input and the desire output.
Input Dataset:
ID Quest Text
1111 C2_1 abcd
1111 C2_2 eeee
1111 C2_3 ffff
1111 C3_1 gggg
1111 C3_2 xyzh
1111 C3_3 mmmm
1111 D4_1 efgh
1111 D4_2 lmno
1111 D4_3 kkkk
1111 D5_1 txyz
1111 D5_2 klmn
1111 D5_3 ctyx
Desired Output should be:
ID QuestInd TextInd QuestOcc TextOcc
1111 C3_1 gggg C2_1 abcd
1111 C3_2 xyzh C2_2 eeee
1111 C3_3 mmmm C2_3 ffff
1111 D5_1 txyz D4_1 efgh
1111 D5_2 klmn D4_2 lmno
1111 D5_3 ctyx D4_3 kkkk
I tried using retain, .first, creating separte data set and remerging.. etc. etc.. nothing seems to be working -
any help will be appriciated.
thanks SK.