PING  0.9
Statistical data handling and processing in production environment
clist_append

Append (i.e., concatenate) a comma-separated quote-enhanced (char or numeric) list to another, possibly interleaving the items in the lists.

%let conc=%clist_append(clist1, clist2, zip=no, mark=%str(%"), sep=%quote(,));

Arguments

  • clist1, clist2 : two lists of formatted (e.g., comma-separated quote-enhanced) strings;
  • zip : (option) a boolean flag (yes/no) set to interleave the lists; when zip=yes, the i-th element from each of the lists are appended together and put into the 2*i-1 element of the output list; the returned list is truncated in length to the length of the shortest list; default: zip=no, i.e. lists are simply appended;
  • 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 clist1 and clist2 are both comma-separated lists of quote-enhanced items; see %clist_unquote for further details.

Returns

conc : output concatenated list of characters, e.g. the list of comma-separated (if sep=%quote(,)) items in between quotes (if mark=%str(%")) obtained as the union/concatenation of the input lists clist1 and clist2.

Examples

%let clist1=("A","B","C","D","E");
%let clist2=("F","G","H","I","J");
%let conc=%clist_append(&clist1, &clist2)

returns: conc=("A","B","C","D","E","F","G","H","I","J").

%let clist0=("1","2","3");
%let conc=%clist_append(&clist0, &clist1, zip=yes)

returns: conc=("1","A","2","B","3","C").

Run macro %_example_clist_append for more examples.

Note

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

%clist_append, %clist_difference, %clist_unquote, %list_quote.