home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / bit / listserv / sasl / 3989 < prev    next >
Encoding:
Text File  |  1992-09-02  |  2.0 KB  |  57 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!DMRHRZ11.BITNET!SCHICK
  3. Message-ID: <SAS-L%92090120450446@AWIIMC12.IMC.UNIVIE.AC.AT>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Mon, 31 Aug 1992 11:41:02 CET
  6. Reply-To:     Arnold Schick <SCHICK@DMRHRZ11.BITNET>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         Arnold Schick <SCHICK@DMRHRZ11.BITNET>
  9. Subject:      Re: print dup records
  10. Lines: 45
  11.  
  12. LYCACC@RITVM.BITNET asks:
  13. >
  14. > I wonder if anyone knows a "easy" way to print duplicate records in a
  15. > data set.  ...
  16. >
  17.  
  18. Hallo,
  19.  
  20. I would like to add one feature to the discussion about dup keys/records
  21. within a SAS data set here:
  22.  
  23. when the SAS data set is to create from an external file, which has (perhaps)
  24. duplicate records and does not span hard-disk-space if it is stored twice,
  25. then helps the following SAS program:
  26.  
  27.            filename file_in 'see operating\system/dependent:conventions.ext';
  28.            filename doubles ' = .dou';
  29.            filename cleared ' = .cle';
  30.            data _NULL_ ;
  31.              infile file_in;
  32.              input rec $char132. ;   *must be longer or equal as longest rec;
  33.              rec_1pre = lag1(rec);
  34.              rec_2pre = lag2(rec);
  35.              rec_3pre = lag3(rec);
  36.              if (rec = rec_3prev) or
  37.                 (rec = rec_2prev) or
  38.                 (rec = rec_1prev) then do; file doubles; put rec; end;
  39.                                   else do; file cleared; put rec; end;
  40.           run;
  41.           data to_print;
  42.             infile doubles ;
  43.             input bill1-bill13;
  44.           run;
  45.           proc print data=to_print;
  46.             title 'Doubles' ;
  47.           run;
  48.  
  49. A sort can also be done by sorting of RECs with proc SORT, if _NULL_ is
  50. substiuted with another data set name and the sorting proc is called. In this
  51. example is only the first or second or thrird successor record of double
  52. presenting relevant. It writes this record to another file and read this
  53. file into a SAS data set separatly.
  54.  
  55.  
  56. Arnold Schick  University of Marburg/Germany
  57.