BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Yoko
Obsidian | Level 7

Hello, 

 

I have a data like this: 

DATA mydata1;
input id code1 code2 code3;
DATALINES;
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16

;
run;

 

Then, I want to re-organize the data such that a new data set looks like this: 

 

id code

1 5

1 9

1 13

2 6

2 10

2 14

3 7

3 11

3 15

4 8

4 12

4 16

 

Is it possible to do this?  If so, how can I re-organize my data?

 

Thank you!

 

Yoko

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20
DATA mydata1;
input id code1 code2 code3;
DATALINES;
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16

;
run;

proc transpose data=mydata1 out=want(rename=(COL1=code) drop=_NAME_);
    by id;
    var code1-code3;
run;

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20
DATA mydata1;
input id code1 code2 code3;
DATALINES;
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16

;
run;

proc transpose data=mydata1 out=want(rename=(COL1=code) drop=_NAME_);
    by id;
    var code1-code3;
run;
Yoko
Obsidian | Level 7

It worked, thank you!

PeterClemmensen
Tourmaline | Level 20

No problem. Glad to help 🙂

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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