Finding the number of observations in the Dataset


 / Published in: SAS
 

URL: http://studysas.blogspot.com/2008/08/finding-number-of-observations-in-sas.html

There are a number of ways of finding out the number of observations in a SAS data set and, while they are documented in a number of different places, I have decided to collect them together in one place. At the very least, it means that I can find them again.

Read more at: http://studysas.blogspot.com/2008/08/finding-number-of-observations-in-sas.html

  1. First up is the most basic and least efficient method: read the whole data set and increment a counter a pick up its last value. The END option allows you to find the last value of count without recourse to FIRST.x/LAST.x logic.
  2.  
  3. data _null_;
  4. set test end=eof;
  5. count+1;
  6. if eof then call symput("nobs",count);
  7. run;
  8.  
  9. read more about 5 more diff ways to find number of observation in a dataset....
  10. : http://studysas.blogspot.com/2008/08/finding-number-of-observations-in-sas.html

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: sarathannapareddy on August 13, 2009

Read more at:

http://studysas.blogspot.com/2008/08/finding-number-of-observations-in-sas.html

You need to login to post a comment.