PING  0.9
Statistical data handling and processing in production environment
list_length

Compute the length of an unformatted (i.e., blank separated) list of strings.

%let len=%list_length(list, sep=%quote( ));

Arguments

  • list : a list of blank separated strings;
  • sep : (option) character/string separator in input list; default: %quote( ), i.e. sep is blank.

Returns

len : output length, i.e. the length of the considered list (calculated as the number of strings separated by sep).

Examples

%let list=DE_UK_LU_AT_EL_IT;
%let len=%list_length(&list, sep=_);

returns len=6.

Run macro %_example_list_length for examples.

Note

As kindly reported by P.BBES.Lamarche (pierr.nosp@m.e.la.nosp@m.march.nosp@m.e@ec.nosp@m..euro.nosp@m.pa.e.nosp@m.u, a.k.a the "Base-Ball Equation Solver") in his own well-tempered language, this macro is mostly useless as one can check that running list_length(&list, &sep) is essentially nothing else than:

%sysfunc(countw(&list, &sep));

Still, we enjoyed recoding it (and so did the GSAST guys, though it seemed "complex"). Further note that one could also use (in the case sep=%quote( )):

%eval(1 + %length(%sysfunc(compbl(&list))) - %length(%sysfunc(compress(&list))))

See also

%clist_length, %list_count, LENGTH. COUNTW.