|Date: ||Sat, 6 Nov 2010 14:06:56 -0700|
|Reply-To: ||Daniel Nordlund <djnordlund@FRONTIER.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Daniel Nordlund <djnordlund@FRONTIER.COM>|
|Subject: ||Re: do loops and math formula|
|Content-Type: ||text/plain; charset="utf-8"|
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Sent: Saturday, November 06, 2010 1:18 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: do loops and math formula
> Hi there,
> Say computing annual investment earnings, we can either using a do loop or
> formula like this:
> I was wondering, which way was more efficient in terms of execution time?
In general, a single formula is going to be more efficient than looping, but then you haven't given us any information about where the variables capital and rate are coming from. Also, we don't know what the structure of the loop is, or what variables it would be operating on, or where the data is coming from.
If you gave a toy example, we could give make more accurate statements about which would be faster.
Bothell, WA USA