BookmarkSubscribeRSS Feed
Ovaty
Fluorite | Level 6

Hi everybody!

 

I need your help to solve my issue.

I need to do a merge/transpose column and leave some columns fixed.

 

Ex.:

CarStateCityPart1Part2Part3Part4
BMWMIDetroit1234
BMWMIDetroit5678
BMWMIDetroit9101112
JaguarUTSLC20212223
JaguarUTSLC24252627
JaguarUTSLC28293031

 

I need this exit below for BMW:

CarStateCityPart
BMWMIDetroit1
BMWMIDetroit2
BMWMIDetroit3
BMWMIDetroit4
BMWMIDetroit5
BMWMIDetroit6
BMWMIDetroit7
BMWMIDetroit8
BMWMIDetroit9
BMWMIDetroit10
BMWMIDetroit11
BMWMIDetroit12

 

Thanks a lot!!!

Gustavo.

2 REPLIES 2
Astounding
PROC Star

This should do it:

 

data want;
   set have;
   array parts {4} part1-part4;
   do k=1 to 4;
      part = parts{k};
      output;
   end;
   drop k part1-part4;
run;
Ovaty
Fluorite | Level 6

Yes, its great!!

 

Thanks a lot!!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 538 views
  • 0 likes
  • 2 in conversation