Search the site...

SASCRUNCH TRAINING
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
  • Home
  • Member's Area
  • How to Start
  • SAS Interface
  • Creating a Data Set
  • Practical SAS Training Course
  • SAS Certified Specialist Training Program
  • Proc SQL Course
  • Introduction to Time Series Analysis
  • SAS Project Training Course
  • Full Training / Membership
  • Sign up
  • About us
  • Contact us
Sentry Page Protection
Please Wait...
Data Manipulation [14-18]


Reverse Transpose
Picture
You can also reverse transpose a data set using Proc Transpose.
Picture

The FOOD data set contains the price for the coffee, muffin, and cookies from McDonald's.

The price for each item is listed in 3 individual columns.
Picture

Let's take a look at how you can reverse transpose the data set and combine the 3 columns into one.

Example

Proc Transpose Data=Food Out=rt_Food;
Var Coffee Muffin Cookies;
Run;
Picture


VAR statement

​The VAR statement lists the variables to be reverse transposed.

In our example, the variables listed there are Coffee, Muffin, and Cookies.
Picture
The prices for all 3 items are now listed under the COL1 variable!
Picture

​NO ID statement

When performing reverse transpose, do NOT include the ID statement. 
Picture

The ID statement is only needed when performing the standard transpose.

Exercise

Copy and run the T_Q2 data set from the yellow box below:

​The T_Q2 data set contains the transposed data set from Q2. 

Perform a reverse transpose on T_Q2 and combine the profit from April, May, and June back into one column.

Create any data set or variable if needed.
Next

Need some help? 


HINT:
A BY statement will be needed.


SOLUTION:
Proc Transpose Data=t_q2 Out=rt_q2;
Var April May June;
By Store;
Run;


Fill out my online form.

Already a member? Go to member's area.