x
Need help studying for the new
SAS Certified Specialist Exam?
SAS Certified Specialist Exam?
Get access to:
- Two Full Certificate Prep Courses
- 300+ Practice Exercises
|
Lesson 4.3: Proc Transpose
IMPORTANT! This tutorial is updated on June 23, 2017. See the latest training on transposing data set in SAS. Proc Transpose converts data from multiple rows into multiple columns. Example
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; Var result; ID Parameter; By Patient; Run; 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! Note:
This happens because the ‘ID’ variables contains more than one reading. This is a common problem when Proc Transpose is being used.
|
|