home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / bit / listserv / sasl / 3947 < prev    next >
Encoding:
Text File  |  1992-08-29  |  2.4 KB  |  69 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!gatech!paladin.american.edu!auvm!NIHCU.BITNET!HIS
  3. Message-ID: <SAS-L%92082812371651@UGA.CC.UGA.EDU>
  4. Newsgroups: bit.listserv.sas-l
  5. Date:         Fri, 28 Aug 1992 12:36:08 EDT
  6. Reply-To:     Howard Schreier <HIS@NIHCU.BITNET>
  7. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  8. From:         Howard Schreier <HIS@NIHCU.BITNET>
  9. Subject: Re: Duplicates
  10. Lines: 57
  11.  
  12. CONTENT:  Follow-up & Comment
  13. SUMMARY:  Add a variable at end of PDV
  14.  
  15. The problem, in brief:  printing duplicate observations from
  16. a data set having a large number of variables.
  17.  
  18. I'm no Kernon/Andy, so I'll stay away from the SQL  :-)  and
  19. stick  with classic SAS.  Tom Abernathy (tom@msvax.mssm.edu)
  20. suggested a clever approach:
  21.  
  22. > This is a simple problem, if you know the LAST variable in the data
  23. > vector. And if you want to take the time to sort it.
  24. >
  25. > PROC SORT;
  26. >  BY _ALL_;
  27. > DATA dups;
  28. >  SET;
  29. >  BY _ALL_;
  30. >  if not (first.Z and last.Z); * Where Z is the last variable ;
  31. > run;
  32. >
  33. > I tested this on VM/CMS version 6.07 of SAS.
  34.  
  35. I'm always a bit uncomfortable  about  relying  on  variable
  36. positions within the vector.  It's also harder to generalize
  37. (as for a macro).
  38.  
  39. How about adding a variable which would then reliably become
  40. the  last  one.  Give it missing values so that it would not
  41. mess up the BY  sequence  or  the  testing  for  duplicates.
  42. Between Tom's two steps, insert:
  43.  
  44.    data tocheck; set; __extra = .;
  45.  
  46. Note the double underscore at the beginning of the name.  If
  47. you  follow  the  convention  of  never  using such names in
  48. permanently stored data sets, it's pretty safe.
  49.  
  50. The subsetting IF becomes:
  51.  
  52.    if not (first.__extra and last.__extra);
  53.    drop __extra;
  54.  
  55. Under 6.07, I would make TOCHECK a DATA step  *view*,  which
  56. would save some resource usage.
  57.  
  58. By the way, I think the very active and  rapid  exchange  of
  59. suggestions   on   this   question  today  has  been  pretty
  60. impressive.  It certainly makes the case for posting  rather
  61. than replying privately, and for an unmoderated list.
  62.  
  63. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  64. \   Howard Schreier, U.S. Dept. of Commerce, Washington    /
  65. /                     MVS 5.18 & 6.07                      \
  66. \   Voice: (202) 377-4180        BITNET: HIS@NIHCU         /
  67. /   Fax:   (202) 377-4614      INTERNET: HIS@CU.NIH.GOV    \
  68. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  69.