home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / bit / listserv / sasl / 5587 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.3 KB  |  63 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!howland.reston.ans.net!paladin.american.edu!auvm!CICERO.SPC.UCHICAGO.EDU!GRANT
  3. Mailer: Elm [revision: 66.25]
  4. Message-ID: <9301121851.AA20764@cicero.spc.uchicago.edu>
  5. Newsgroups: bit.listserv.sas-l
  6. Date:         Tue, 12 Jan 1993 12:51:39 CST
  7. Reply-To:     Grant Blank <grant@CICERO.SPC.UCHICAGO.EDU>
  8. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  9. From:         Grant Blank <grant@CICERO.SPC.UCHICAGO.EDU>
  10. Subject:      Comparison SQL to data step
  11. Lines: 50
  12.  
  13. ----------------------------------------------------------------------
  14. CONTENT:   Comparison of SQL to data step for finding non-matching obs.
  15. SUMMARY:   SQL 25 times faster than data step
  16. REL/PLTF:  6.07 all platforms
  17. E-ADDR:    grant@sam.spc.uchicago.edu
  18. NAME:      Grant Blank
  19. ADDRESS:   1700 East 56th Street #2307 Chicago IL 60637-1935
  20. PHONE:     312/947-8194
  21. ----------------------------------------------------------------------
  22.  
  23. Those who work with SQL may be interested in the following results.
  24. I needed to match a sample with the universe to find nonmatching (i.e.
  25. invalid) IDs.  The sample contains 1505 cases, the universe contains
  26. 92,454.  The SQL code is 7 lines and produced a list of 39 IDs in
  27. 0.31 seconds on a UNIX HP 9000/750.  The SAS data step is 6 lines and
  28. required 7.94 seconds.  SQL was faster by a factor of over 25 times!
  29.  
  30. -Grant
  31.  
  32. The relevant portions of the SAS log are below.
  33.  
  34. 20
  35. 21         data a;
  36. 22            merge library.comb02 (in = incomb) library.sc_link (in = inlink);
  37. 23            by pin;
  38. 24            if qed_type not in ('C', 'P');
  39. 25            if incomb = 1 and inlink = 0 then output;
  40. 26            run;
  41.  
  42. NOTE: The data set WORK.A has 39 observations and 33 variables.
  43. NOTE: DATA statement used:
  44.       real time           19.919 seconds
  45.       cpu time            7.940 seconds
  46.  
  47. 27
  48. 28
  49. 29         proc sql;
  50. 30            create table nomatch as
  51. 31               select *
  52. 32               from library.comb02
  53. 33               where qed_type not in ('C', 'P')
  54. 34                  and pin not in
  55. 35                     (select pin from library.sc_link)
  56. 36               ;
  57. NOTE: Table WORK.NOMATCH created, with 39 rows and 32 columns.
  58.  
  59. 37            quit;
  60. NOTE: PROCEDURE SQL used:
  61.       real time           4.481 seconds
  62.       cpu time            0.310 seconds
  63.