PING  0.9
Statistical data handling and processing in production environment
clist_length

Compute the length of a formatted (i.e., comma-separated and quota-enhanced) list of strings.

%let len=%clist_length(clist, mark=%str(%"), sep=%quote(,));

Arguments

  • clist : a list of formatted (e.g., comma-separated quote-enhanced) strings;
  • mark, sep : (option) characters/strings used respectively as a "quote" and a separator in the input list; default: mark=str(%"), and" sep=%quote(,), i.e. the input clist is a comma-separated list of quote-enhanced items; see %clist_unquote for further details.

Returns

len : output length, i.e. the length of the considered list (say it otherwise, the number of strings separated by mark).

Examples

%let clist=("DE","AT","BE","NL","UK","SE");
%let len=%clist_length(&clist);

returns len=6.

Run macro %_example_clist_length for more examples.

Notes

  1. Note the "special" treatment of empty items, e.g.
%let clist=("DE",,,,"UK");
%let len=%clist_length(&clist);

will return len=2, i.e. the comma-separated empty items are not taken into account in the counting.

  1. See note of %list_length.
  2. The macro will not return exactly what you want if the symbol $ appears somewhere in the list. If you need to use $, you can reset the global macro variable G_PING_UNLIKELY_CHAR (see _setup_ file) to another dumb (unlikely) character of your own.

See also

%list_length, %clist_unquote.