|
Soumi
Here are two solutions. The one using Proc transpose does not require that
you write out all of the names of the variables that you want to work with.
You could also write the second method using an array and a do loop.
Nat Wooding
Data start;
input AL KL;
cards;
1 5
2 6
3 7
4 8
;
Proc Transpose data = start out = want (rename = ( Col1 = LM) Keep = col1);
by al;
var _numeric_;
run;
Data Want2;
set start;
keep LM;
LM = AL;
Output;
LM = Kl;
output;
run;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Soumi
Ray
Sent: Wednesday, February 15, 2012 9:35 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: combine two variables into one
Hello,
I have a dataset like this:
AL KL
1 5
2 6
3 7
4 8
I want a new variable which will be:
LM
1
5
2
6
3
7
4
8
Could anyone please help?
Thanks
Soumi
|