home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!DMRHRZ11.BITNET!SCHICK
- Message-ID: <SAS-L%92090120450446@AWIIMC12.IMC.UNIVIE.AC.AT>
- Newsgroups: bit.listserv.sas-l
- Date: Mon, 31 Aug 1992 11:41:02 CET
- Reply-To: Arnold Schick <SCHICK@DMRHRZ11.BITNET>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Arnold Schick <SCHICK@DMRHRZ11.BITNET>
- Subject: Re: print dup records
- Lines: 45
-
- LYCACC@RITVM.BITNET asks:
- >
- > I wonder if anyone knows a "easy" way to print duplicate records in a
- > data set. ...
- >
-
- Hallo,
-
- I would like to add one feature to the discussion about dup keys/records
- within a SAS data set here:
-
- when the SAS data set is to create from an external file, which has (perhaps)
- duplicate records and does not span hard-disk-space if it is stored twice,
- then helps the following SAS program:
-
- filename file_in 'see operating\system/dependent:conventions.ext';
- filename doubles ' = .dou';
- filename cleared ' = .cle';
- data _NULL_ ;
- infile file_in;
- input rec $char132. ; *must be longer or equal as longest rec;
- rec_1pre = lag1(rec);
- rec_2pre = lag2(rec);
- rec_3pre = lag3(rec);
- if (rec = rec_3prev) or
- (rec = rec_2prev) or
- (rec = rec_1prev) then do; file doubles; put rec; end;
- else do; file cleared; put rec; end;
- run;
- data to_print;
- infile doubles ;
- input bill1-bill13;
- run;
- proc print data=to_print;
- title 'Doubles' ;
- run;
-
- A sort can also be done by sorting of RECs with proc SORT, if _NULL_ is
- substiuted with another data set name and the sorting proc is called. In this
- example is only the first or second or thrird successor record of double
- presenting relevant. It writes this record to another file and read this
- file into a SAS data set separatly.
-
-
- Arnold Schick University of Marburg/Germany
-