Folks,
I've merged two datasets and have some reason duplicates corrected within it. I would like to know where these duplicates exist. Thus I've used the following piece of code;
proc sort data=accs dupout=dups nodupkey out=correct; by idinternal customernumber idoccurrence;
RUN;In the accs dataset I've 315,050 observations and in the correct dataset I've 312,326. However, the dups dataset is empty.
So it would appear that I've circa 2,700 duplicate observations but they are no where to be seen?
Could somone shed some light on the this issue, please?
Try this, to view the total occurrences for each permutation of your variables:
PROC SQL;
CREATE TABLE TOTALOCCURRENCE AS
SELECT IDINTERNAL, CUSTOMERNUMBER, IDOCCURRENCE, COUNT(*) AS TOTAL FROM ACCS GROUP BY IDINTERNAL, CUSTOMERNUMBER, IDOCCURRENCE;
QUIT;Then, after viewing, if you would like a dataset of distinct occurrences, you could write:
PROC SQL;
CREATE TABLE ALLDISTINCT AS
SELECT DISTINCT IDINTERNAL, CUSTOMERNUMBER, IDOCCURRENCE FROM ACCS;
QUIT;
It looks like NODUPKEY is kicking in, removing duplicates before the DUPOUT= option can examine. Try removing NODUPKEY and see if that resolves the problem.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.