Hello everyone! I am hoping for your help today - I struggeled all day yesterday! I want to go from long to wide in my dataset in SAS 9.4. The dataset has these variables; ID, dateIn, dateOut, JournalNo, MainDiag, Diag2, Diag3. Some ID's have many diagnoses from different dates or the same dates, and some are the same, some are not. So some ID's are allready in the dataset many times. I've sorted the dataset so there is no dublicate rows with the same ID and diagnose, keeping the oldest one. I did that this way: proc sort data=mydata;
by ID_ descending DateIn;
run;
proc sort data=mydata nodupkey;
by ID_ MainDiag Diag1 Diag2 Diag3
run; Hope that is correct? I need this dataset to be long instead of wide, regarding the diagnoses So, I want all diagnoses to list under eachother and end up with only one variable containing the diagnoses. I don't care if they were the main diagnose or not. I have tried the transpose function in 1000 different ways, but it is just not working out for me. I hope this is enough info for getting help Looking forward to hearing from someone. Regards, Ninna
... View more