Also, one additional feature/benefit is where you can use two back-to-back PROC SORT executions, and only the second would have the DUPOUT=, possibly using the NODUPKEY option additionally to control SAS behavior -- but also investigate the EQUALS option which is sometimes needed in the last SORT execution. With EQUALS you can influence how your sort package (or SAS internal sort) sequences or leaves alone the incoming observation order, again, from a prior SORT.
For example, say you want to eliminate all duplicates and send them to another file (using DUPOUT= with NODUPKEY specified), however you also may want to have a previous SORT with a more granular BY variable list, one that ensure some additional sort-order ahead of the DUPOUT= / NODUPKEY sort execution.
And, also to remember (discussed in these forums before), it's up to the programmer to ensure that the PROC SORT BY variable list is granular enough to ensure that "duplicate observations" (achieved by either NODUPS or NODUPKEY) end up being adjacent, otherwise the sort-operation will not necessarily remove the duplicates -- they must be adjacent to achieve duplicate-deletion.
Happy Sorting People!
Scott Barry
SBBWorks, Inc.
Suggested Google advanced search arguments, this topic / post discussion:
+"proc sort" +equals +sortequals behavior site:sas.com
+"proc sort" by variable list remove duplicates site:sas.com