LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 4 Feb 2011 20:33:04 -0800
Reply-To:     Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jack Hamilton <jfh@STANFORDALUMNI.ORG>
Subject:      Re: Newbee question regarding keep option
Comments: To: Arthur Tabachneck <art297@ROGERS.COM>
In-Reply-To:  <201102041429.p14BlDLn008746@waikiki.cc.uga.edu>
Content-Type: text/plain; charset=iso-8859-1

Just out of curiosity, what happens if you make the data step in test 3 a data step view instead?

On Feb 4, 2011, at 6:29 AM, Arthur Tabachneck wrote:

> In another of this week's threads Sterling was asking how to speed up a proc > means he was running. I think that Søren probably provided what was needed. > > I was going to ask Sterling if the input file contained a LOT of variables > that weren't being considered in the desired analysis. However, I decided > to test my suggestion before asking the question. > > Given a test like that shown below, I have always thought that test2 was the > same as test3 other than, of course, possibly some IO time reading in the > wider file. I was quite surprised in the differences not just in real time, > but in CPU time. > > Test1 and Test2 run at about the same speed, although with a lot of variance > between replications. > > Test3 runs incredibly faster! Is that what everyone would have expected? I > have always been under the impression that the keep statement got rid of the > unnecessary baggage. > > /* Create test data */ > data a; > array jj(1000); > array kk(1000); > do i=1 to 100000; > do j=1 to 1000; > jj(j)=rannor(0); > end; > do k=1 to 1000; > kk(k)=rannor(0); > end; > ii=mod(i,50); > output; > end; > run; > > /* Test 1 */ > proc means noprint missing nway data = a; > var jj1 jj2 jj3 jj5; > class ii; > output out = t1 (drop = _TYPE_ _FREQ_) sum()=; > run; > > /* Test 2 */ > proc means noprint missing nway data = a > (keep=ii jj1 jj2 jj3 jj4 jj5); > var jj1 jj2 jj3 jj4 jj5; > class ii; > output out = t2 (drop = _TYPE_ _FREQ_) sum()=; > run; > > /* Test 3 */ > data b; > set a (keep=ii jj1 jj2 jj3 jj4 jj5); > run; > proc means noprint missing nway data = b; > var jj1 jj2 jj3 jj4 jj5; > class ii; > output out = t3 (drop = _TYPE_ _FREQ_) sum()=; > run; > > Art


Back to: Top of message | Previous page | Main SAS-L page