|
Pat,
For test sakes, I have created a 15-record flat file 'FQUAL.TEST' with first
two bytes as follows:
2b
2b
4d
3c
3c
3c
1a
5e
5e
6f
7g
8h
9i
0j
0j
Now I am going to steal a trick from Ian Whitlock's bag:
filename in 'fqual.test' disp=shr;
data all/view=all;
infile in firstobs=1; input @1 key 1. @2 info $1.;
run;
data key/view=key;
infile in firstobs=2; input @1 key2 1.;
run;
data nodup (drop=key2);
merge all key;
if key2 ne key;
run;
Printing NODUP shows:
Obs Key Info
------------------
1 2 b
2 4 d
3 3 c
4 1 a
5 5 e
6 6 f
7 7 g
8 8 h
9 9 i
10 0 j
------------------
Looks like the trick works.
Kind regards,
======================
Paul M. Dorfman
Jacksonville, Fl
======================
>From: p_flick@MY-DEJA.COM
>Reply-To: p_flick@MY-DEJA.COM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: seeing ahead
>Date: Fri, 12 Jan 2001 18:12:59 GMT
>
>I've seen this a long time ago, but can't rememeber where or when. We
>have a need to see if the next record in a flat file contains duplicate
>information. If so, we want to keep all the records pertaining to that
>information, and delete those that don't have duplication. I've seen
>something similar to LAG, but in reverse, awhile ago. Anyone have an
>idea? In the meantime, the only other way that I can think to do this
>is to do duplicate reads via an input, or to get all the info
>initially, then do a sort and a if not first.....
>
>Thanks in advance for any help.
>
>Regards,
>Pat Flickner
>
>
>Sent via Deja.com
>http://www.deja.com/
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
|