I have a data set in which I have duplicates (rcode, pcodes, and prov). I want to create a new table in which these are deduped, but retaining the first time they were experienced as unique by (keydt). I cant use proc sort nodupkey because I need to include keydate in the sort, and will yield no dups by that particular date. If I don’t use the keydate the sort will then sort by rcode, pcode and prov; and will not yield the first time the unique combination was observed.
Another option if you want more "control" is to consider using a DATA step with a SET statement, a BY statement (input file must be sorted by the variable list), and use IF FIRST.variable_name and if necessary IF LAST.variable_name, and the OUTPUT statement to create the file as needed.