On Tue, 29 Oct 2002 16:37:16 -0500, Ian Whitlock <WHITLOI1@WESTAT.COM>
>It doesn't look accurate in my test.
>1645 data w ;
>1646 do x = 1 to 5 ; output ; end ;
>1647 run ;
>NOTE: The data set WORK.W has 5 observations and 1 variables.
>NOTE: DATA statement used:
> real time 0.11 seconds
>1649 proc sql noprint ;
>1650 select * from w ;
>1651 %put &sqlobs ;
Has this odd "gotcha" been discussed in SAS-L before? If so, my apologies
and please read no further. If not, then my question is, has anybody else
ever found this behavior of sqlobs awfully counter-intuitive? In the on-
line documentation, "Using Macro Variables Set by Proc SQL", the example
in fact demonstrates the precise behavior Ian points out: if noprint is
set, and you just do a select, sqlobs=1, regardless of how many rows would
have been returned if noprint were off. Remove the noprint, and you get
(the correct) 5. Leave the noprint in and add a "create table as. . ."
and you get (also intuitively correct) 5. But just do a select with
noprint, you get 1. At the very least, shouldn't it be 0? There are a
couple other gotchas with sqlobs that escape me now.
In most of the other SQL implementations of which I'm aware, the
corresponding system variable contains the # of rows returned, period. I
think SI might want to consider changing the function of this variable, or
at least documenting it with more than just a "for example." Any thoughts?