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