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 21:30:28 -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?

I realize I'm PROBABLY quibbling here (and I've DEFINITELY taken this thread off topic), but your thoughtful (as always) and eminently practical response doesn't help my nagging concern that the action of sqlobs is logically inconsistent. You reminded me that the other gotcha is with "into".

First:

> I understand that without "separated by" or a range of mVar names, > only one row is output into the mVar. > That would appear to be consistent with having > &sqlObs = 1 > The issue may be just what &sqlObs is counting... > It appears to be only rows output......

Sure, if there's an "into". But now remove the "into", and leave the "noprint" in place. How many rows are output? As near as I can tell, there is no output whatsoever. So shouldn't sqlobs be 0? But it's not; it's 1.

Second:

> the only context where this might bother me, always seems to work > proc sql noprint ; > select something > into :list separated by ' ' > from somewhere > where <IwantIt> ; > %let n_wanted = &sqlobs; > quit; > has "so-far" been reliable ! (thank goodness) > > Is this because that "separated by ...." forces the output.of more than one row ?

Are you sure it always works? Before you run the sample program below, form a hypothesis on what the value of sqlobs is in each of the 6 queries below.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * data one; do i = 1 to 5; output; end; run; /* make a sample dataset */ * run a couple queries; proc sql; select i into :listi1-:listi4 from one; %put &sqlobs; select i into :listi1-:listi999 from one; %put &sqlobs; select i into :listi separated by ' ' from one; %put &sqlobs; proc sql noprint; select i into :listi1-:listi4 from one; %put &sqlobs; select i into :listi1-:listi999 from one; %put &sqlobs; select i into :listi separated by ' ' from one; %put &sqlobs; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Now, logically, am I nuts to think you should get the same value of sqlobs in each case? Well, as they used to say in Sesame Street, "One of these things is not like the others."

I beg the groups forgiveness for spending so much time on an issue that has very little practical consequence in our day-to-day work.

Karl


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