Date: Mon, 26 Nov 2007 11:05:42 -0700
Reply-To: Jerry L Diebal <jdiebal@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jerry L Diebal <jdiebal@GMAIL.COM>
Subject: Array Problem???
Content-Type: text/plain; charset=ISO-8859-1
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;