Select Page

SAS Proc Transpose- How to Re-Transpose or Un-Transpose

SAS Proc Transpose- How to Re-Transpose or Un-Transpose

There may come a weird scenario when you have to re-transpose or un-transpose or transform from wide to long. Here i am using the sample set we used for transposing and will un-transpose it using same way( uh we can use old data set- Yeah but i just want to show how can i do it with using Proc Transpose again.

so here is sample code:-

proc sql;

create table xyz1 as SELECT distinct catx (‘ ‘,Make , Model) as Intro , Type , Origin , EngineSize , Cylinders, Length FROM SASHELP.CARS group by type order by type,Intro;


proc transpose data=xyz1 out=xyzt1;

by type;

var EngineSize Cylinders Length ;

id Intro;

/* But what if you want to re- Tranpose or Untranspose or from wide to lond table transformation */

proc transpose data=xyzt out=unxyzt;

by type;

var ‘Honda Civic Hybrid 4dr manual (g’n ‘Honda Insight 2dr (gas/electric)’n ‘Toyota Prius 4dr (gas/electric)’n ‘Acura MDX’n ‘BMW X3 3.0i’n ‘BMW X5 4.4i’n ‘Buick Rainier’n ‘Buick Rendezvous CX’n ‘Cadillac Escalade’n ‘Cadillac SRX V8’n ‘Chevrolet Suburban 1500 LT’n ‘Chevrolet Tahoe LT’n ‘Chevrolet Tracker’n ‘Chevrolet TrailBlazer LT’n ‘Dodge Durango SLT’n ‘Ford Escape XLS’n ‘Ford Excursion 6.8 XLT’n ‘Ford Expedition 4.6 XLT’n ‘Ford Explorer XLT V6’n ‘GMC Envoy XUV SLE’n ‘GMC Yukon 1500 SLE’n ‘GMC Yukon XL 2500 SLT’n ‘Honda CR-V LX’n ‘Honda Element LX’n ‘Honda Pilot LX’n ‘Hummer H2’n ‘Hyundai Santa Fe GLS’n;

About The Author

I like to write. So i write everything. No specific rules but here to enjoy the ride.

Like us or Dislike us. Please Let us know Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Comments