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;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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
  • 3 replies
  • 1008 views
  • 1 like
  • 4 in conversation