Given your reference to "unique" and "repeat", review the topic BY GROUP PROCESSING within a DATA step (on a sorted input file). You will want to consider how to use IF FIRST. and/or LAST. to identify unique or repeat occurrences within your data, which is combined with a BY statement. Honestly, I have no clue why you embarked on the MACRO route to start....
Also, search the archives as we as SAS.COM on the topic for code examples and explanations -- this topic has been discussed before.
And, for self-initiated DATA step debugging, look at using PUTLOG _ALL_; where you will see the "1" and "0" conditions being set by SAS for the FIRST/LAST conditions when you code the BY statement with your "key" variables.
Scott Barry
SBBWorks, Inc.
Google advanced argument, this topic / post:
by group processing site:sas.com
Message was edited by: sbb