BookmarkSubscribeRSS Feed
trishaechual
Calcite | Level 5

Hey all,

 

i'm trying to figure out how to eliminate repeating attributes in my dataset.

 

For example, i want:

 

TICKET_ID     STATUS1    STATUS2    STATUS3    STATUS5     STATUS6

 

 

to become:

 

TICKET_ID     STATUS

 

 

Assuming the statuses are unique.

 

Please help!       

2 REPLIES 2
PGStats
Opal | Level 21

This operation is usually called "going from wide to long". It can be performed with arrays, which offer efficiency and flexiblility, but a simpler way is to use proc transpose:

 

proc transpose data=have out=want(rename=col1=STATUS);
by ticket_id notsorted;
var status1-status6;
run;
PG
Reeza
Super User

Here are two links that illustrate using arrays & proc transpose

 

http://www.ats.ucla.edu/stat/sas/modules/wtol_transpose.htm

http://www.ats.ucla.edu/stat/sas/modules/widetolong_data.htm

 

Both methods are also used to go from long to wide. 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1054 views
  • 0 likes
  • 3 in conversation