| Date: | Mon, 8 Oct 2007 13:15:34 -0400 |
| Reply-To: | Sigurd Hermansen <HERMANS1@WESTAT.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Sigurd Hermansen <HERMANS1@WESTAT.COM> |
| Subject: | Re: Q: SAS counts one record read too many? |
|
| In-Reply-To: | <200710081643.l98FScOI032308@mailgw.cc.uga.edu> |
| Content-Type: | text/plain; charset="us-ascii" |
Jim:
I won't claim to have any expertise in Data step processes, but I did
notice that running your program with an empty dataset produces a
different log than running it with a dataset with one or more rows. The
SAS Data step compiler obviously recognizes an empty dataset and reports
on the log that it reads 0 observations. It likely reads one and only
one row if a dataset has one or more observations, perhaps to determine
whether it has reached the end of the dataset.
S
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Jim Groeneveld
Sent: Monday, October 08, 2007 12:43 PM
To: SAS-L@LISTSERV.UGA.EDU; joep Steeman
Subject: Re: Q: SAS counts one record read too many?
Thanks Joep,
Yes we know that, _N_ is not being incremented in the presented
examples. But the issue has not to do with _N_. In the meantime I
understood from a few replies that it has to do with the sneaky
characteristic of SAS to read one record ahead when END= is in effect in
order to look ahead for end-of dataset-file. And once encountered SAS
does not need to be sneaky anymore so then the number of read records is
as expected. But as long as not encountered the number read is always
one more than logically expected.
I think this also explains Gerhard's two remaining mysteries.
I am satisfied with this explanation if it is correct.
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
On Mon, 8 Oct 2007 09:24:25 -0700, Joep Steeman
<jsteeman@BUSINESSDECISION.COM> wrote:
[.........]
>> - Tekst uit oorspronkelijk bericht weergeven -
>
>Gents,
>
>I did not go into depth in the examples, but thought is, might it have
>something to do with the fact _n_ is *not* a records counter, but a
>counter of the number of loops through the program?
>
>Just a hinch.
>
>Best regards, Joep
|