@danhopkinslewis wrote:
Thanks. So if I wanted to bring in all the other variable columns but not include them in the count, how would I do that?
Do ALL of the other variables where you have duplicates have the same values?
If not you will need to decide which ones you want.
If the idea is to add a code that the variable combination is a duplicate then you could merge this back on the original data.
Again pseudo code because you haven't mentioned names of data sets or variables: The below renames the count to indicate that it is indeed a duplicate count.
Proc sort data=have;
by var1 var2;
run;
data final;
merge have want( rename=(count=dupecount) ); by var1 var2;
run;
If you want a simple flag for "this record is part of a duplicate set" you could add something like:
Flag = (dupecount>1);
SAS will treat the result of logical comparisons as a numeric one when true and zero when false.
Other logic could be used depending on what you want.
... View more