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 (September 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 3 Sep 2003 09:25:57 -0400
Reply-To:     Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:      Re: An efficiency question
Comments: To: "sashole@bellsouth.net" <sashole@bellsouth.net>
Comments: cc: "cjsadler@HOTMAIL.COM" <cjsadler@HOTMAIL.COM>
Content-Type: text/plain

Paul,

If Chris is really up against the wall on time, I would suggest that it is time for you peek and poke magic. Maybe use INDEX to search for "3244" etc. If found then check if the index is at the beginning of a variable if not then search from that point on until the begin point is grater than the length of the relevant area.

IanWhitlock@westat.com

-----Original Message----- From: Paul Dorfman [mailto:paul_dorfman@HOTMAIL.COM] Sent: Wednesday, September 03, 2003 2:16 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: An efficiency question

Chris,

You are searching sequentially but not stopping short when the condition is satisfied and keep going all the way to i=30. This should improve the loop performance about twice *on the average*:

do i = 1 to 30 until ( flag1 and flag2 ) ; if _vars_(i) in ('3244','5664','6756') then flag1=1; if _vars_(i) in ('6546','4433') then flag2=1; end;

Kind regards, ================= Paul M. Dorfman Jacksonville, FL =================

>From: Christopher Sadler <cjsadler@HOTMAIL.COM> >Reply-To: Christopher Sadler <cjsadler@HOTMAIL.COM> >To: SAS-L@LISTSERV.UGA.EDU >Subject: An efficiency question >Date: Wed, 3 Sep 2003 01:56:35 +0000 > >I have a dataset with a large number of variables that need to be evaluated >to see if *any* of them fit into certain categories. The way it's written >now is shown in a simplified example below. The problem is that the >dataset is very large (3 million records, with many more to be added) >and it >takes a long time to run. I suspect a major inefficiency with the code >below is that do loop. Is there a way to rewrite this to improve the >processing speed? > >Thanks! >Chris Sadler > >A simplified example: > >data new; >set old; > array _vars_(30) var1-var30; > > do i = 1 to 30; > if _vars_(i) in ('3244','5664','6756') then flag1=1; > if _vars_(i) in ('6546','4433') then flag2=1; >end; > >run; > >_________________________________________________________________ >MSN 8: Get 6 months for $9.95/month. >http://join.msn.com/?page=dept/dialup

_________________________________________________________________ Get MSN 8 and help protect your children with advanced parental controls. http://join.msn.com/?page=features/parental


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