The macro is generic and can be applied to any valid SAS dataset, whether it is created internally, comes from default SAS libraries like SASHELP (as in the commented example), or from external sources. It does not handle the creation or management of source data, but operates on existing data.
1 Code Block
MACRO nobs
Explanation : This block defines the `%nobs` macro. It uses `%sysfunc(open(&dset))` to obtain a dataset identifier, then `%sysfunc(attrn(&dsid,nobs))` to extract the number of observations. The number is then displayed (`&nobs`), and the dataset is closed by `%sysfunc(close(&dsid))`. The commented lines are examples of use and do not affect the macro definition.
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright Astellas Europe B.V, Macro name: nobs.sas, Version: 001, Author: Phil Mason, Date: 1Sep2008, SAS version: 9.1.3 SP4
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.