Help using Base SAS procedures

Proc Transpose case

Accepted Solution Solved
Reply
Contributor
Posts: 42
Accepted Solution

Proc Transpose case

Hi,

 

I have a table with three mains columns

 

*product

*type

*price

 

I want to transpose it in a way to have a new table with:

*product

*type1_price

*type2_price

...

*typen_price

 

Exemple:

Table Have

product type price
A Z1 32
A Z2 22
B Z1 24
B Z2 18

Table Want

product Z1 Z2
A 32 22
B 24 18

I don't get it with the common proc transpose

 

Do you have an idea to do it?

Thanks


Accepted Solutions
Solution
‎02-22-2017 01:22 PM
Respected Advisor
Posts: 3,780

Re: Proc Transpose case

proc transpose data=product out=wide(drop=_name_);
   by product;
   id type;
   var price;
   run;

View solution in original post


All Replies
Solution
‎02-22-2017 01:22 PM
Respected Advisor
Posts: 3,780

Re: Proc Transpose case

proc transpose data=product out=wide(drop=_name_);
   by product;
   id type;
   var price;
   run;
Contributor
Posts: 42

Re: Proc Transpose case

Thanks, it works! Smiley Happy

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 141 views
  • 1 like
  • 2 in conversation