[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: STATA Vs. SAS
> -----Original Message-----
> From: Nick Cox [mailto:firstname.lastname@example.org]
> Sent: Wednesday, November 27, 2002 2:55 PM
> To: email@example.com
> Subject: RE: st: STATA Vs. SAS
> Richard Herrell
> > On Wed, 27 Nov 2002, Nick Cox wrote:
> > > Richard Herrell
> > > >
> > > > if x=0 then y=1;
> > > > else if 1 < x < 10 then y=2;
> > > > else if 11 < x < 20 then y=3;
> > > > else y=.
> > In SAS, the code exits the structure when a true condition
> > is met. In
> > Stata, every if condition is evaluated even after the true
> > condition is
> > met.
> Perhaps we are not talking about
> the same thing here. I was assuming
> that -x- and -y- are _variables_.
I took Richard's point to be that, *for each observation*, the
evaluation of conditions only need take place until a true condition is
found for *that observation*. So, in the Stata code, Stata will
evaluate three conditions per observation; SAS will evaluate fewer than
that, depending on which conditions apply to which cases.
I'd be curious to hear someone from StataCorp's thoughts on this -
comparing efficiency of different conditional structures, across
programs, seems difficult at best. Stata seems to have put a lot of
work into making internal replacements over observations extremely fast
and efficient. If that process is much more efficient than SAS's
movement through conditions within observations, then the efficiency
advantage could well go to Stata.
* For searches and help try: