Unit under Test: nobs.sas
Test Coverage: 100%

Color Legend:
dummy Text
  Covered code
  Non covered code
  Comments
  Code marked as non contributing by option mcoverage


RowNumberOut pgmSourceColumn
00001 /**
00002 \file
00003 \ingroup SASUNIT_EXAMPLES_PGM
00004
00005 \brief Return number of observations in a SAS dataset.
00006
00007 Return number of logical observations (deleted obeservations are not counted) in a SAS dataset.
00008 In case of an invalid dataset specification, a blank will be returned.
00009
00010 Example: \%put \%nobs(dataset);
00011
00012 \version \$Revision: 315 $
00013 \author \$Author: klandwich $
00014 \date \$Date: 2014-02-28 10:25:18 +0100 (Fr, 28 Feb 2014) $
00015 \sa For further information please refer to SASUnit User's Guide
00016 \sa \$HeadURL: https://svn.code.sf.net/p/sasunit/code/trunk/example/saspgm/nobs.sas $
00017 \copyright Copyright 2010, 2012 HMS Analytical Software GmbH.
00018 This file is part of SASUnit, the Unit testing framework for SAS(R) programs.
00019 For terms of usage under the GPL license see included file readme.txt
00020 or https://sourceforge.net/p/sasunit/wiki/readme.v1.2/.
00021
00022 \param data SAS dataset to count observations from
00023 \return number of observations in input dataset
00024 */ /** \cond */
00025
00026 %MACRO nobs(
00027 data
00028 );
00029 %local dsid nobs;
00030 %let nobs=;
00031 %let dsid=%sysfunc(open(&data));
00032 %if &dsid>0 %then %do;
00033 %let nobs=%sysfunc(attrn(&dsid,nlobs));
00034 %let dsid=%sysfunc(close(&dsid));
00035 %end;
00036 &nobs
00037 %MEND nobs;
00038 /** \endcond */


Generated on Friday, 21 March 2014, 11:40:00 by SASUnit SASUnit Version 1.3.0 (320)