Date: Wed, 3 Jul 2002 12:29:54 -0400
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: SAS vs. SQL
I have learned about one point, where PROC SQL is dramatic faster than a
PROC or DATA: accessing the SASHELP.Vnnnnnn views!!
Try it out!
Use:
data test;
set sashelp.vcolumn;
where libname="SASUSER" and memname="CLASS";
keep name;
run; /* get the variables for sasuser.class */
versus
proc sql;
create table test2 as
select name from sashelp.vcolumn
where libname="SASUSER" and memname="CLASS";
quit;
should do the same... and the results are really identical! But...
40 data test;
41 set sashelp.vcolumn;
42 where libname="SASUSER" and memname="CLASS";
43 keep name;
44 run;
NOTE: There were 5 observations read from the data set SASHELP.VCOLUMN.
WHERE (libname='SASUSER') and (memname='CLASS');
NOTE: The data set WORK.TEST has 5 observations and 1 variables.
NOTE: DATA statement used:
real time 12.81 seconds
cpu time 3.09 seconds
44 ! /* get the variables for sasuser.class */
45
46
47
48 proc sql;
49 create table test2 as
50 select name from sashelp.vcolumn
51 where libname="SASUSER" and memname="CLASS";
NOTE: Table WORK.TEST2 created, with 5 rows and 1 columns.
52 quit;
NOTE: PROCEDURE SQL used:
real time 0.15 seconds
cpu time 0.05 seconds
I've did 10 or more runs of that, also in other order. Always the same.
Only at first run the data step needed much more!
I don't know why that is so, but it is!