SASCRUNCH TRAINING
  • Home
  • Online Courses
    • Practical SAS Training Course for Beginners
    • SAS Base Certification Training Course
    • Proc SQL Course
    • SAS Project Training Course
    • Logistic Regression (Credit Scoring) Modeling using SAS
  • Services
    • The Ultimate Job Search Automation Services
    • Statistical Consulting
    • SAS Assignment Help
    • Data Import Services
    • Data Manipulation and Reporting Services
  • Articles
    • Get Started >
      • 18 Free Resources to Help You Learn SAS
      • How to Install SAS Studio
      • How to Learn SAS Fast
    • Data Import >
      • Importing Excel Spreadsheet
      • Importing CSV Files
      • Importing Text Files
    • SAS Functions >
      • CAT, CATT, CATS, CATX Functions
      • If-Then-Else statement
      • TRIM Function
      • STRIP Function
      • YEAR, MONTH, DAY Functions
      • Compress Function
      • Do-Loop
      • SCAN Function
      • LIKE Operator
      • INDEX Function
    • Data Manipulations >
      • The Ultimate Guide to Proc SQL
      • Proc Datasets
      • Dictionary Tables
      • Dealing with Missing Values
      • Proc Compare
      • Proc Transpose
      • RETAIN Statement
      • SAS Formats
      • SAS Arrays
    • Statistical Analysis >
      • Proc Means
      • Proc Freq
      • Proc Tabulate
    • Informational Interviews >
      • Senior Recruiter at a Fortune 500 Retail Company
      • Manager, Non-profit Health Services Research
      • HR Manager
      • Quantitative Analyst
  • In-class Training
    • SAS Training for Job Seekers
  • Toronto Meetup
  • Guest Lecture
  • Sample Resume
  • About us
  • Contact Us
Master SAS
​in 30 Days
Start your Free training now!
x
Get Certified as a SAS Base Programmer
28
Training Modules
200+
Exam Questions
100%
Instructor Support
100%
Pass
​Guarantee
Start your free training now
 
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.
Picture
Picture

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.  
Picture
(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:

  1. Proc Transpose requires each ‘ID’ variable contains only one result. In this example, each of the Parameters (Height, Weight … etc) contains only one reading. If we add an extra reading to the dataset, there will be an error shown on the log window.
Picture
Picture
This happens because the ‘ID’ variables contains more than one reading. This is a common problem when Proc Transpose is being used.
Previous
Next

    Have a Question?

Submit
 

Master SAS in 30 Days

Start your Free training now!
Copyright © 2012-2017 SASCrunch.com All rights reserved.
  • Home
  • Online Courses
    • Practical SAS Training Course for Beginners
    • SAS Base Certification Training Course
    • Proc SQL Course
    • SAS Project Training Course
    • Logistic Regression (Credit Scoring) Modeling using SAS
  • Services
    • The Ultimate Job Search Automation Services
    • Statistical Consulting
    • SAS Assignment Help
    • Data Import Services
    • Data Manipulation and Reporting Services
  • Articles
    • Get Started >
      • 18 Free Resources to Help You Learn SAS
      • How to Install SAS Studio
      • How to Learn SAS Fast
    • Data Import >
      • Importing Excel Spreadsheet
      • Importing CSV Files
      • Importing Text Files
    • SAS Functions >
      • CAT, CATT, CATS, CATX Functions
      • If-Then-Else statement
      • TRIM Function
      • STRIP Function
      • YEAR, MONTH, DAY Functions
      • Compress Function
      • Do-Loop
      • SCAN Function
      • LIKE Operator
      • INDEX Function
    • Data Manipulations >
      • The Ultimate Guide to Proc SQL
      • Proc Datasets
      • Dictionary Tables
      • Dealing with Missing Values
      • Proc Compare
      • Proc Transpose
      • RETAIN Statement
      • SAS Formats
      • SAS Arrays
    • Statistical Analysis >
      • Proc Means
      • Proc Freq
      • Proc Tabulate
    • Informational Interviews >
      • Senior Recruiter at a Fortune 500 Retail Company
      • Manager, Non-profit Health Services Research
      • HR Manager
      • Quantitative Analyst
  • In-class Training
    • SAS Training for Job Seekers
  • Toronto Meetup
  • Guest Lecture
  • Sample Resume
  • About us
  • Contact Us
✕