|Date: ||Wed, 11 Jul 2007 19:25:55 +0530|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Diwakar Sharma <Diwakar_Sharma@MCKINSEY.COM>|
|Subject: ||Proc means VS Proc SQL for summarizing|
|Content-Type: ||text/plain; charset="US-ASCII"|
I used to be a firm believer that whatever Proc SQL can do, SAS (DATA &
Proc) can do better.
Recently I tried performing a summary using both Proc means and Proc SQL,
and found Proc SQL taking less time than PROC means.
Here is the code I used
proc means data=test_data MISSING NOPRINT;
proc sql _METHOD;
create table out_sql as
select category , sum(sales) as sum_sales
group by category;
Here is the log
242 proc means data=test_data MISSING NOPRINT;
243 class category;
244 types category;
245 output out=out_means
NOTE: There were 407649 observations read from the data set
NOTE: The data set WORK.OUT_MEANS has 29 observations and 4 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 6.26 seconds
cpu time 6.96 seconds
249 proc sql _METHOD;
250 create table out_sql as
251 select category , sum(sales) as sum_sales
252 from test_data
253 group by category;
NOTE: SQL execution methods chosen are:
sqxsrc( WORK.TEST_DATA )
NOTE: Table WORK.OUT_SQL created, with 29 rows and 2 columns.
NOTE: PROCEDURE SQL used (Total process time):
real time 3.51 seconds
cpu time 1.54 seconds
Could someone please let me know the reason of this difference ??
This message may contain confidential and/or privileged
information. If you are not the addressee or authorized to
receive this for the addressee, you must not use, copy,
disclose or take any action based on this message or any
information herein. If you have received this message in
error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.