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 1997, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 5 Nov 1997 16:55:42 CST
Reply-To:     Undetermined origin c/o LISTSERV administrator
              <owner-LISTSERV@UGA.CC.UGA.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
Comments:     RFC822 error: <E> "From:"/"Sender:" field is missing.
From:         Undetermined origin c/o LISTSERV administrator
              <owner-LISTSERV@UGA.CC.UGA.EDU>
Subject:      Re[2]: macro variable
Comments: To: pprimak@genzyme.com

Philip Primak <pprimak@GENZYME.COM> wrote:

>Use the following code (if you have SAS 6.12+ or 6.09E+): >%let dsid=%sysfunc(open(yourdata)); >%let numobs=%sysfunc(attrn(&dsid,nobs)); >%let rc=%sysfunc(close(&dsid)); > >Then macro variable numobs will be equal to number of observations in >your data set.

I haven't tested this, but you might want to use the NLOBS (logical observations) attribute instead of the NOBS attribute, in case there are deleted observations in the dataset.

Also, while you're using the data set functions anyway, you might as well check the value of the ANOBS attribute to see whether the engine knows the correct number of observations.

Have these functions been documented anywhere other than the draft Macro Facility Enhancements paper?


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