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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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