Date: Mon, 16 Sep 2002 16:17:03 +0530
Reply-To: sahu prasanta <Sahu.Prasanta@UNILEVER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: sahu prasanta <Sahu.Prasanta@UNILEVER.COM>
Subject: <No Subject>
Content-Type: MULTIPART/ALTERNATIVE; DIFFERENCES=Content-Language;
Dear SAS users,
I have got a data A where I want to add a new variable with reference to
another variable with " if then " statements But the arguments for these
if then are in another data set B.
data A
_______________
var1 other variables........
________________
1
3
5
9
7
6
5
5
9
8
6
3
1
4
.
.
.
.
.
data B
_______________
var1 var2 other variables......
_______________
1 a
2 b
3 c
4 d
5 e
. .
. .
. .
. .
and I want the final data C as
___________________
var1 var2 othervariables
___________________________
1 a
3 c
5 e
9 .
7 .
6 .
5 .
5 .
9
8
6
3
1
4
.
.
.
.
.
I was using the following statements
data C;
set A;
if var1=1 then var2='a';
if var1=2 then var2='b';
etc.
run;
But this is quite difficult as the data set B is itself having some 100
rows, and I believe there must be an easy way out as I am new to SAS.
P S: I have used simple letters like a, b, c etc. for the var2, but the
actual words are quite big.
Prasanta Kumar Sahu
Hindustan Lever Limited
Research Center
No. 64, Whitefield Main Road
Bangalore, India
Phone +91-80 8451505 ext. 420
Fax +91-80 8453086
[text/html]
|