| Date: | Wed, 1 Nov 2000 14:16:53 +0100 |
| Reply-To: | Peter Crawford <peter.crawford@DB.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Peter Crawford <peter.crawford@DB.COM> |
| Subject: | Re: SAS/Base: automatic variable _n_ behavior |
|
| Content-type: | text/plain; charset=iso-8859-1 |
so what is wrong with a structure I consider to be very clear and why
say "(the structure should probably be avoided)" ?
puddin'man say.......
""
It seems, however, I've run across several programs resembling:
data ...;
set ...;
...
if <cond1>;
...
if <cond2>;
...
if <condition testing _n_> then <take action>;
...
and if folks dealing with such code didn't know when _n_
incremented, they would likely get into trouble. They may
anyway (the structure should probably be avoided).
""
I don't expect you have run across any of my code, but the above
style IMHO wins hands down over the corresponding over-weighty
nested "if then do end else do end" structures.
It is allways disappointing when testing the end-of-data
conditions preclude subsetting if statements.
The prerequisite for encouraging use of the "subsetting if" is
that maintainers of the code understand the principle.
Surely ( like understanding _n_ ) that is not much to ask ?
Would you want the applications you create to be "enhanced" by
maintenance programmers who are learning to program ?
with kind regards
Peter Crawford
Datum: 01/11/2000 02:54
An: SAS-L@listserv.uga.edu
Antwort an: pudding_man@postmark.net
Betreff: Re: SAS/Base: automatic variable _n_ behavior
Nachrichtentext:
> This would argue for an increment occuring at the start rather than
the
> end of the loop. Where atomic distinctions are critical, the accuracy
> may be helpful.
I dunno no "atomic". :-)
> Wassup, Puddin'?
Not much, really. Wasn't my intention to make a "big deal"
about it ...
It seems, however, I've run across several programs resembling:
data ...;
set ...;
...
if <cond1>;
...
if <cond2>;
...
if <condition testing _n_> then <take action>;
...
and if folks dealing with such code didn't know when _n_
incremented, they would likely get into trouble. They may
anyway (the structure should probably be avoided).
And, besides, Greg _was_ correct.
I thought you had an alpha or beta of Linux/SAS. Perhaps
it hasn't been released ...
Puddin'
"Now, I may look like I'm crazy,
but po' John do know right from wrong!"
-from "Drop Down, Mama", Sleepy John Estes
*******************************************************
*** Puddin' Man *** Pudding_Man@postmark.net *****
******************************************************;
kmself@IX.NETCOM.COM wrote:
> on Tue, Oct 31, 2000 at 08:25:31PM +0000, Puddin' Man
(pudding_man@postmark.net) wrote:
> > I don't think you have to pass thru the implied RETURN
> > to increment _N_.
> >
> > The following suggests that Greg may be correct:
> >
> > 8 data a;
> > 9 do i=1 to 9; output; end;
> >
> > NOTE: The data set WORK.A has 9 observations and 1 variables.
> > NOTE: DATA statement used:
> > real time 0.12 seconds
> > cpu time 0.02 seconds
> >
> >
> > 10 data b;
> > 11 set a;
> > 12 if 3<i<6 then delete;
> > 13 put i= _n_=;
> > 14 run;
> >
> > i=1 _N_=1
> > i=2 _N_=2
> > i=3 _N_=3
> > i=6 _N_=6
> > i=7 _N_=7
> > i=8 _N_=8
> > i=9 _N_=9
> > NOTE: There were 9 observations read from the dataset WORK.A.
> > NOTE: The data set WORK.B has 7 observations and 1 variables.
> > NOTE: DATA statement used:
> > real time 0.12 seconds
> > cpu time 0.02 seconds
>
> This would argue for an increment occuring at the start rather than the
> end of the loop. Where atomic distinctions are critical, the accuracy
> may be helpful.
>
> Wassup, Puddin'?
>
> --
> Karsten M. Self <kmself@ix.netcom.com> http://www.netcom.com/~kmself
> Evangelist, Opensales, Inc. http://www.opensales.org
> What part of "Gestalt" don't you understand? There is no K5 cabal
> http://gestalt-system.sourceforge.net/ http://www.kuro5hin.org
>
--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
|