LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 20 Feb 2004 11:37:01 -0500
Reply-To:   diskin.dennis@KENDLE.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Dennis Diskin <diskin.dennis@KENDLE.COM>
Subject:   Re: SAS Array logic problem
Comments:   To: Debbie Cooper <debbie.cooper@STEVENSONCOMPANY.COM>
Content-Type:   text/plain; charset="us-ascii"

Debbie,

Is this what you want?

data test2; set test; array wbb(*) wbb_0 - wbb_1; array obb(*) wbbapp wbbprice wbbfeat wbbname wbbwarr wbbprev wbbqual wbbrec wbbsize wbboth; do z = 1 to 10; obb(z) = 2; end; do k = 1 to 2; do z = 1 to 10; if wbb(k) = z then obb(z) = 1; else if wbb(k) = . then obb(z) = .; end; end;

Dennis Diskin

Debbie Cooper <debbie.cooper@STEVENSONCOMPANY.COM> Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> 02/20/2004 11:23 AM Please respond to Debbie Cooper

To: SAS-L@LISTSERV.UGA.EDU cc: 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