Date: Mon, 26 Nov 2007 18:23:22 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Array Problem???
In-Reply-To: <3cf9f5a80711261005h6145ff20yd7102eb43a3d612e@mail.gmail.com>
Content-Type: text/plain; charset="Windows-1252"
Data Need ;
Set Have ;
By PartNo ;
Retain Flag1 Flag2 ;
If First.PartNo Then Call Misisng( Flag1 , Flag2 ) ;
If Process In ( 111 222 333 ) Then Flag1 = 1 ;
If Process In ( 777 888 999 ) Then Flag2 = 1 ;
If Flag1 And Flag2 Then Output ;
Run ;
Toby Dunn
"Don't bail. The best gold is at the bottom of barrels of crap."
Randy Pausch
"Be prepared. Luck is where preparation meets opportunity."
Randy Pausch
> Date: Mon, 26 Nov 2007 11:05:42 -0700
> From: jdiebal@GMAIL.COM
> Subject: Array Problem???
> To: SAS-L@LISTSERV.UGA.EDU
>
> I have a dataset that has partnumbers and operations. Each operation has a
> process associated with it. I need to look at all opno's for each partno and
> find if any opno for that part has a process of 111, 222, or 333. If that
> partno has one or more of those processes, I then need to look through the
> remaining processes for that partno to see if any processes are in 777, 888,
> or 999. If so, I want to keep that partnumber. If not, discard it. Lag would
> work (the way I know how to use it) except that this involves multiple
> choices. Thanks in advance.
>
>
>
> DATA HAVE;
> INPUT
> partno $
> opno
> process ;
> DATALINES;
> AAA 10 111
> AAA 20 222
> AAA 30 333
> AAA 40 444
> AAA 50 555
> AAA 60 666
> AAA 70 777
> AAA 80 888
> AAA 90 999
> BBB 10 111
> BBB 20 222
> BBB 30 333
> BBB 40 444
> BBB 50 555
> BBB 60 666
> CCC 10 111
> CCC 20 555
> CCC 30 666
> CCC 40 777
> CCC 50 888
> CCC 60 999
> ;
> RUN;
>
> /* For each partno, IF PROCESS IN ONE OF THE FOLLOWING ('111' '222' '333')
> the program
> will then look through the remaining opno's to find any PROCESSES IN ('777'
> '888' '999').
> If any occurences are found, keep that partno */
>
>
> DATA WANT;
> INPUT
> partno $
> opno
> process ;
> DATALINES;
> AAA 10 111
> AAA 20 222
> AAA 30 333
> AAA 40 444
> AAA 50 555
> AAA 60 666
> AAA 70 777
> AAA 80 888
> AAA 90 999
> CCC 10 111
> CCC 20 555
> CCC 30 666
> CCC 40 777
> CCC 50 888
> CCC 60 999
> ;
> RUN;
>
> /*or DATA WANT could be like this:*/
>
> DATA WANT;
> INPUT
> partno $;
> DATALINES;
> AAA
> CCC
> ;
> RUN;
_________________________________________________________________
You keep typing, we keep giving. Download Messenger and join the i’m Initiative now.
http://im.live.com/messenger/im/home/?source=TAGLM