```Date: Fri, 20 Feb 2004 09:04:01 -0800 Reply-To: "Choate, Paul@DDS" Sender: "SAS(r) Discussion" From: "Choate, Paul@DDS" Subject: Re: SAS Array logic problem Comments: To: Debbie Cooper Debbie - This works...but I'm not sure how you want to handle "wbb_0=. or wbb_1=." 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; keep id wbbapp wbbprice wbbfeat wbbname wbbwarr wbbprev wbbqual wbbrec wbbsize wbboth; array obb(*) wbbapp wbbprice wbbfeat wbbname wbbwarr wbbprev wbbqual wbbrec wbbsize wbboth; do z = 1 to 10; if wbb_0=. and wbb_1=. then obb(z) = .; else obb(z) = 2; end; if wbb_0 ne . and wbb_1 ne . then do; obb(wbb_0)=1; obb(wbb_1)=1; end; run; /* 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 */ hth Paul Choate DDS Data Extraction (916) 654-2160 -----Original Message----- From: Debbie Cooper [mailto:debbie.cooper@STEVENSONCOMPANY.COM] Sent: Friday, February 20, 2004 8:23 AM To: SAS-L@LISTSERV.UGA.EDU Subject: SAS Array logic problem 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 ```

Back to: Top of message | Previous page | Main SAS-L page