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 (November 1999, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 16 Nov 1999 08:46:06 -0800
Reply-To:   "Berryhill, Tim" <TWB2@PGE.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Berryhill, Tim" <TWB2@PGE.COM>
Subject:   Re: Number of obs in dataset
Comments:   To: Jacques Thibault <JacquesT@IPRONLINE.COM>
Content-Type:   text/plain

Uhm, if DSNAME has zero observations, then the data step stops when the SET statement executes, and the CALL SYMPUT never executes. In that case, you probably get a value of 1 from some previous call. Reverse the SET and CALL statements. It is curious, but the nobs= option applies even if the statement never executes. To be cute, I sometimes code this as DATA _NULL_; CALL SYMPUT('NOBS',NOBS); STOP; SET DSNAME NOBS=NOBS; RUN;

Tim Berryhill - Contract Programmer and General Wizard TWB2@PGE.COM or http://www.aartwolf.com/twb.html Frequently at Pacific Gas & Electric Co., San Francisco The correlation coefficient between their views and my postings is slightly less than 0

> ---------- > From: Jacques Thibault[SMTP:JacquesT@IPRONLINE.COM] > Reply To: Jacques Thibault > Sent: Tuesday, November 16, 1999 8:00 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Number of obs in dataset > <SNIP> > ... > data _null_; > set dsname nobs=n; > call symput('nbobs',n); > stop; > run; > > I know this looks pretty simple, and when I test only this (presuming > dsname > has 0 obs.), it works. But when including the same lines in my macro, it > doesn't work anymore. Is anyone got this problem before? Is there any > other way to get the number of obs. (like in SQL...)?... > > Thanks for helping... >


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