Unit under Test: getvars.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 variable names for a SAS dataset
00006
00007 Example: \%put \%getvars(dataset);
00008
00009 \version \$Revision: 315 $
00010 \author \$Author: klandwich $
00011 \date \$Date: 2014-02-28 10:25:18 +0100 (Fr, 28 Feb 2014) $
00012 \sa For further information please refer to SASUnit User's Guide
00013 \sa \$HeadURL: https://svn.code.sf.net/p/sasunit/code/trunk/example/saspgm/getvars.sas $
00014 \copyright Copyright 2010, 2012 HMS Analytical Software GmbH.
00015 This file is part of SASUnit, the Unit testing framework for SAS(R) programs.
00016 For terms of usage under the GPL license see included file readme.txt
00017 or https://sourceforge.net/p/sasunit/wiki/readme.v1.2/.
00018
00019 \param data SAS dataset to return variable names from
00020 \param dlm delimiter, default is a blank
00021 \return list of variable names from input dataset, separated by specified delimiter
00022 */ /** \cond */
00023
00024 %MACRO getvars(
00025 data
00026 ,dlm=
00027 );
00028 %local varlist dsid i;
00029 %if "&dlm"="" %then %let dlm=%str( );
00030 %let dsid = %sysfunc(open(&data));
00031 %if &dsid %then %do ;
00032 %do i=1 %to %sysfunc(attrn(&dsid,NVARS));
00033 %if &i=1 %then
00034 %let varlist = %sysfunc(varname(&dsid,&i));
00035 %else
00036 %let varlist = &varlist.&dlm.%sysfunc(varname(&dsid,&i));
00037 %end;
00038 %let dsid = %sysfunc(close(&dsid));
00039 %end;
00040 &varlist
00041 %MEND getvars;
00042 /** \endcond */


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