LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2002, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 29 Oct 2002 17:38:02 -0500
Reply-To:   "Karl K." <karlstudboy@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Karl K." <karlstudboy@HOTMAIL.COM>
Subject:   Re: How to return the rows number of a data set?

On Tue, 29 Oct 2002 16:37:16 -0500, Ian Whitlock <WHITLOI1@WESTAT.COM> wrote:

>Jack, > >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 > > >1648 >1649 proc sql noprint ; >1650 select * from w ; >1651 %put &sqlobs ; >1

<snipped>

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?

Karl


Back to: Top of message | Previous page | Main SAS-L page