Date: Fri, 20 Feb 2004 11:23:02 -0500
Reply-To: Debbie Cooper <debbie.cooper@STEVENSONCOMPANY.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Debbie Cooper <debbie.cooper@STEVENSONCOMPANY.COM>
Subject: SAS Array logic problem
Content-Type: text/plain; charset="iso-8859-1"
I'm using the following code:
data test;
input @1 id 1. @5 wbb_0 2. @10 wbb_1 2.;
cards;
1 2 3
2
3 1 2
4 1 6
;
run;
data test2;
set test;
array wbb(*) wbb_0 - wbb_1;
array obb(*) wbbapp wbbprice wbbfeat wbbname wbbwarr wbbprev wbbqual
wbbrec wbbsize wbboth;
do k = 1 to 2;
do z = 1 to 10;
if wbb(k) = z then do;
obb(z) = 1;
end;
else if wbb(k) = . then do;
obb(z) = .;
end;
else do;
obb(z) = 2;
end;
end;
end;
I want to end up with this:
id wbbapp wbbprice wbbfeat wbbname wbbwarr wbbprev wbbqual wbbrec wbbsize
wbboth;
1 2 1 1 2 2 2 2 2 2
2
2 . . . . . . . . .
.
3 1 1 2 2 2 2 2 2 2
2
4 1 2 2 2 2 1 2 2 2
2
How do I get from point a to point b? Should I scrap the array alltogether?
Thanks,
Debbie