Lesson 4.3: Proc Transpose
Proc Transpose converts data from multiple rows into multiple columns.
The first dataset contains the patients' info before TRANSPOSE and the second one after TRANSPOSE.
As you can see, the patients' info were listed in multiple rows prior to running the PROC TRANSPOSE procedure. After the procedure, all of the info from each patient were listed in one single row.
Now, let's take a look at the codes we used to achieve this.
PROC SORT Data=Before; By Patient; Run;
PROC TRANSPOSE Data=Before Out=After;
Again, Proc Transpose requires the dataset to be sorted prior to running the procedure.
(1) ‘Var’ identifies the results to be transposed.
(2) ‘ID’ identifies the name of the variables to be transposed.
(3) ‘By’ statement ensures the data is transposed by each patient.
DONE! You have learned how to use Proc Transpose in SAS!
This happens because the ‘ID’ variables contains more than one reading. This is a common problem when Proc Transpose is being used.