Desktop productivity for business analysts and programmers

Normalize the dataset

Reply
New Contributor
Posts: 4

Normalize the dataset

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!       

Respected Advisor
Posts: 4,820

Re: Normalize the dataset

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
Super User
Posts: 19,171

Re: Normalize the dataset

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. 

 

Ask a Question
Discussion stats
  • 2 replies
  • 167 views
  • 0 likes
  • 3 in conversation