PING  0.9
Statistical data handling and processing in production environment
express_comparison

Calculate the transform of a list given by a mapping table (similarly to a LookUp Transform, LUT).

express_comparison(arg, _exp_=, force_sql=NO);

Cassell, L.D. (2005): PRX functions and Call routines.

comparison operators:

Calculate the transform of a list given by a mapping table (similarly to a LookUp Transform, LUT).

%list_map(map, list, _maplst_=, var=, casense=no, sep=%quote( ), lib=WORK);

Arguments

  • map : input mapping table, i.e. dataset storing the lookup correspondance;
  • list : list of unformatted strings;
  • var : (option) fields of the map table used as origin and destination (in this order) of the mapping; default: var=1 2, i.e. the first and second fields (in varnum order) are used as origin and destination respectively;
  • casense : (option) boolean flag (yes/no) set to perform cases sensitive comparison/matching; default: casense=no, i.e. upper-case items in list and the origin variable are matched;
  • sep : (option) character/string used as a separator in the input lists; default: sep=%quote( ), i.e. the input list1 and list2 are both blank-separated lists of items;
  • lib : (option) input library where map is stored; default: lib is set to WORK.

Returns

_maplst_ : name of the variable storing the output list built as the list of items obtained through the transform defined by the variables var of the table map, namely: assuming all elements in list can be found in the (unique) observations of the origin variable, the element in the i-th position of the output list is the j-th element of the destination variable when j is the position of the i-th element of list in the origin variable.

Example

Given test dataset _dstest32:

geo value
BE 0
AT 0.1
BG 0.2
LU 0.3
FR 0.4
IT 0.5

used as a mapping table, running the simple operation:

%let list=FR LU BG;
%let maplst=
%list_map(_dstest32, &list, _maplst_=maplst, var=1 2);

returns: maplst=0.4 0.3 0.2.

Run macro %_example_list_map for more examples.

Note

It is not checked that the values in the origin variable are unique.

See also

%var_to_list, %list_find, %list_index, %ds_select.