/******************* URBAN INSTITUTE MACRO LIBRARY *********************
: ListUnion
Macro: Autocall macro returns a union of items between
Description
two lists. All duplicate items are removed.
: Function
Use
: Peter Tatian
Author
***********************************************************************/
ListUnion(
%macro /* List of items #1 */
list1, /* List of items #2 */
list2, delim=%str( ) /* Delimiter for list (def. blank char) */
);
/*************************** USAGE NOTES *****************************
:
SAMPLE CALLListUnion( A B C D, E F G )
%
returns A B C D E F G*********************************************************************/
/*************************** UPDATE NOTES ****************************
*********************************************************************/
***** ***** ***** MACRO SET UP ***** ***** *****;
%
%local ListUnion;
***** ***** ***** ERROR CHECKS ***** ***** *****;
%
***** ***** ***** MACRO BODY ***** ***** *****;
%
%let ListUnion = %ListNoDup( %unquote( &list1&delim&list2 ), delim=&delim );
&ListUnion
:
%exit
***** ***** ***** CLEAN UP ***** ***** *****;
%
%mend ListUnion;
/************************ UNCOMMENT TO TEST ***************************
**options mprint symbolgen mlogic;
** Autocall macros **;
"K:\Metro\PTatian\UISUG\Uiautos\";
filename automac options sasautos=(automac sasautos);
%let list1 = A B C D;
%let list2 = E F G;
%let union = [%ListUnion( &list1, &list2 )];
%put _user_;
%let list1 = A B C D;
%let list2 = A B E F D G;
%let union = [%ListUnion( &list1, &list2 )];
%put _user_;
/**********************************************************************/
Union of Two Lists
Purpose: Autocall macro returns a union of items between two lists. All duplicate items are removed.