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 (February 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 13 Feb 2002 12:20:15 -0500
Reply-To:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:   Re: How to return the number of records in a dataset

On Wed, 13 Feb 2002 12:03:09 -0500, Carriere, Ron <rcarriere@MEDNET.UCLA.EDU> wrote:

>The NOBS option of the SET statement returns the number of records in a >dataset after reading the first record. > >7 DATA _NULL_; >8 SET ONE(OBS=1) NOBS=RECS; >9 PUT 'RECORDS = ' RECS; >10 >11 >12 > >RECORDS = 109 >NOTE: There were 1 observations read from the data set WORK.ONE. >NOTE: The DATA statement used 0.00 CPU seconds and 23291K. > > >Ron Carriere >UCLA Medical Center

in the simplest case: yes, but...

Not, if you have a view, not if you have deleted obs in the dataset. Deleted obs you might get, if your dataset is manipulated by FSP or an AF application. In that cases you should use other functions. I've deleted one obs in SASUSER.CLASS. Note the following log:

41 data test; 42 rc=open("sasuser.class"); 43 lobs=attrn(rc,"nlobs"); 44 obs=attrn(rc,"nobs"); 45 put obs= lobs=; 46 run;

obs=19 lobs=18

You see, you get 19 obs, but you can use only 18!


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