PING  0.9
Statistical data handling and processing in production environment
list_count

Count the number of occurences of an element in a (blank separated) list.

%let count=%list_count(list, item, casense=no, sep=%quote( ));

Arguments

  • list : a list of blank separated strings;
  • item : a string defining the pattern to count for the occurrence of appearance in input list;
  • casense : (option) boolean flag (yes/no) set to perform cases sensitive search/matching; default: casense=no, i.e. the upper-case pattern item will be searched/matched;
  • sep : (option) character/string separator in input list; default: %quote( ), i.e. sep is blank.

Returns

count : output count number, i.e. the number of times the element item appears in the list; note that when the element item is not found in the input list, it returns count=0 as expected.

Examples

Let us consider a simple example:

%let list=NL UK AT DE AT BE AT;
%let count=%list_count(&list, AT);

which returns count=3.

Run macro %_example_list_count for more examples.

See also

%list_slice, %list_find, %list_remove, %list_length.