Hi all, I am seeking some help in converting a free text variable that contains multiple observations into a numeric variable while expanding to a long data set with potentially multiple rows per person. Basically, in my "have" dataset, the AE_free_text includes codes for adverse events that were entered with codes in free text. When an individual had more than one adverse event at a study visit, the data entry person inputted this all on the same row. I want to have a long dataset so that each adverse event is on one line per participant. Thank you! I look forward to learning from your responses. Have: ID Visit AE_free_text 1 1 1,4 2 1 1 3 1 2,4 4 1 1 5 1 1 6 1 3,9 7 1 3 8 1 2 Want: ID Visit AE_num 1 1 1 1 1 4 2 1 1 3 1 2 3 1 4 4 1 1 5 1 1 6 1 3 6 1 9 7 1 3 8 1 2 Sample data: data have;
input id Visit AE_free_text;
cards;
1 1 1,4
2 1 1
3 1 2,4
4 1 1
5 1 1
6 1 3,9
7 1 3
8 1 2
;
... View more