Macros for SAS Application Developers
https://github.com/sasjs/core
mf_getvarcount.sas File Reference

Returns number of variables in a dataset. More...

Go to the source code of this file.

Detailed Description

Useful to identify those renagade datasets that have no columns! Can also be used to count for numeric, or character columns

%put Number of Variables=%mf_getvarcount(sashelp.class);
%put Character Variables=%mf_getvarcount(sashelp.class,typefilter=C);
%put Numeric Variables = %mf_getvarcount(sashelp.class,typefilter=N);

returns:

Number of Variables=4

Parameters
[in]libdsTwo part dataset (or view) reference.
[in]typefilter=(A) Filter for certain types of column. Valid values:
  • A Count All columns
  • C Count Character columns only
  • N Count Numeric columns only
Version
9.2
Author
Allan Bowe

Definition in file mf_getvarcount.sas.