PING
0.9
Statistical data handling and processing in production environment
|
Compare two lists of characters/strings, i.e check whether the items in one list differ from those in another not taking into account any order or repetition(s).
list1, list2
: two lists of items;casense
: (option) boolean flag (yes/no
) set to perform cases sensitive search/matching; default: casense=no
, i.e. the upper-case elements in both lists are matched;sep
: (option) character/string separator in input list; default: %quote( )
, i.e. items are separated by a blank.ans
: the boolean result of the comparison test of the "sets" associated to the input lists, i.e.:
0
when both lists are equal: list1 = list2
,-1
when list1
items are all included in list2
(but the opposite does not stand): say it otherwise: list1 < list2
,1
when list2
items are all included in list1
(but the opposite does not stand): say it otherwise: list1 > list2
,ans=
) when they differ.Simple examples (with casense=yes
by default):
returns ans=-1
, while:
returns ans=1
, and:
returns ans=0
. We also further use the case sensitiviness (yes/no
) for comparison:
return ans1=
(i.e. list differ) and ans2=0
(i.e. lists are equal with default casense=no
).
Run macro %_example_list_compare
for examples.
ans=
).%list_compare
may still return 0
, for instance: %let list1=NL DE AT BE; %let list2=DE AT NL BE NL BE; %let ans=%list_compare(&list1, &list2);returns
ans=0
...%clist_compare, %list_remove, %list_count, %list_slice, TRANWRD, FINDW.