PING  0.9
Statistical data handling and processing in production environment
var_count

Return the number of missing and non-missing values of a given variable in a dataset.

%var_count(dsn, var, _count_=, _nmiss_=, lib=WORK);

Arguments

  • dsn : a dataset reference;
  • var : a field name whose information is provided;
  • lib : (option) output library; default: lib is set to WORK.

Returns

_count_, _nmiss_ : (option) names of the macro variables used to store the count or non-missing and missing values of the var variable in the dataset respectively; though both optional, one at least should be passed.

Examples

Let us consider the table _dstest28:

geo value
' '1
AT .
BG 2
'' 3
FR .
IT 5

then we can find the number of non-missing/missing value by running:

%let count=;
%let nmiss=;
%var_count(_dstest28, value, _count_=count, _nmiss_=nmiss);

which returns count=4 and nmiss=2.

Run macro %_example_var_count for more examples.

See also

%ds_count, %var_check, %var_info.