BookmarkSubscribeRSS Feed
Ypss
Calcite | Level 5

Hi

I have a dataset that looks like this:

abcde
13579
246810

How to change it to:

CharacterNumber
a1
a2
b3
b4
c5
c6
d7
d8
e9
e10

Thank you in advance!

3 REPLIES 3
mohamed_zaki
Barite | Level 11

data have;

input a b c d e;

cards;

1 3 5 7 9

2 4 6 8 10

;

run;

proc transpose data=have out=have;

run;

proc transpose data=have out=have;

by _name_;

run;

Loko
Barite | Level 11

Hello,

A data step solution:

data have;
input a b c d e;
datalines;
1 3 5 7 9
2 4 6 8 10
;

data want;
set have;
array vars{*} a--e;
do i=1 to dim(vars);
character=vname(vars{i});
number=vars{i};
output;
end;

keep character number;
run;

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1183 views
  • 1 like
  • 4 in conversation