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 (December 1998, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Dec 1998 15:41:56 -0800
Reply-To:     "Berryhill, Timothy" <TWB2@PGE.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "Berryhill, Timothy" <TWB2@PGE.COM>
Subject:      Re: Why doesn't NOBS work?
Comments: To: Frank Berger <Frank.D.Berger@DAL.FRB.ORG>
Content-Type: text/plain

It will, it will! As the original poster finally mentioned, his dataset SEARCH contained a variable named NOBS. All of the replies assumed he was attempting to use the NOBS= option of a SET statement. Since setting past the end of a dataset stops a data step, when you use the NOBS= option, you read the variable BEFORE you define it. In the example below, move lines 546 and 547 before line 544 (before the SET statement which will end the step).

> ---------- > From: Frank Berger[SMTP:Frank.D.Berger@DAL.FRB.ORG] > Reply To: Frank Berger > Sent: Wednesday, December 30, 1998 10:04 AM > To: SAS-L@UGA.CC.UGA.EDU > Subject: Re: Why doesn't NOBS work? > > Hmmm....out of curiosity I tried this under AIX...doesn't work. It seems > that with zero observations in the dataset, SAS won't do anything, > including assigning the value of nobs (0) to a variable. > > Bertil Runstrvm wrote: > > > Yes, change your code to: > > data _null_; > > 544 set search nobs=nobs; > > 545 file print; > > 546 if nobs=0 and _n_ le 1 then put > > 547 'EMPTY DATA SET!!!'; > > 548 run; > > Best regards > > Bertil Runstrvm > > > > E. S. skrev i meddelandet > > <19981230161252.13794.rocketmail@web305.yahoomail.com>... > > >This piece of code will work in the mainframe, but for some reason it > > >won't in the PC. Any ideas as of why?? > > > > > >543 data _null_; > > >544 set search; > > >545 file print; > > >546 if nobs=0 and _n_ le 1 then put > > >547 'EMPTY DATA SET!!!'; > > >548 run; >


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