PING  0.9
Statistical data handling and processing in production environment
clist_to_var

Insert into a (possibly already existing) dataset a variable formatted as a list of (e.g., comma-separated and quote-enhanced) values.

%clist_to_var(clist, var, dsn, mark=%str(%"), sep=%quote(,), lib=WORK);

Arguments

  • clist : list of formatted (e.g., comma-separated, quote-enhanced, parentheses-enclosed) items;
  • var : name of the variable to use in the dataset;
  • 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

  • dsn : output dataset; if the dataset already exists, then observations with missing values everywhere except for the variable var (possibly not present in dsn) will be appended to the dataset;
  • lib : (option) output library; default (not passed or ''): lib is set to WORK.

Examples

The following instructions:

%let clist=("DE", "UK", "SE", "IT", "PL", "AT");
%clist_to_var(&clist, geo, dsn);

return in WORK.dsn the following table:

Obsgeo
1 DE
2 UK
3 SE
4 IT
5 PL
6 AT

Run macro _example_clist_to_var for more examples.

Note

If the dataset already exists and there are no numeric, or character variables in it, then the following warning will be issued:

WARNING: Defining an array with zero elements.

This message is not an error. See %list_to_var.

See also

%list_to_var, %var_to_clist, %clist_unquote.