BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
赵家钧
Fluorite | Level 6

I'm wondering if there exists any difference between NODUPKEY and  NODUPRECS options ? In my view, they seem totally the same with a BY statement.

1 ACCEPTED SOLUTION

Accepted Solutions
kiranv_
Rhodochrosite | Level 12

go through this article, it explains everything step by step with examples.

 

https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/037-30.pdf

 

View solution in original post

6 REPLIES 6
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

NODUP will delete duplicated observations (records that are identical to each other) while NODUPKEY will delete those observations that have duplicate BY values (the sort BY variables that you name in PROC SORT).

Links to SAS papers can be found here
https://communities.sas.com/t5/SAS-Programming/Difference-between-NOdup-and-NoDupkey/m-p/29490#M6614...

 

赵家钧
Fluorite | Level 6
But..... NODUPRECS option also has a BY statement. Aren't they the same?
kiranv_
Rhodochrosite | Level 12

go through this article, it explains everything step by step with examples.

 

https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/037-30.pdf

 

赵家钧
Fluorite | Level 6
I think I get the answer just after reading the ABSTRACT!!! Thank you a lot! I just wrongly thought that the BY statement of NODUP can be customized depending on my needs.
Reeza
Super User
NODUPRECS has been removed from PROC SORT (documentation) but it still works for backwards compatibility. I would not recommend developing any programs that rely on the functionality of NODUPRECS today.

If you've read the paper, there are some gotcha's about it that often caught people, so they changed the functionality.
agoldma
Pyrite | Level 9

In addition to Reeza, another person from SAS Support also said that NODUPRECS has been removed from the most recent documentation (9.4) because it works in an unexpected/unreliable way.

Instead of NODUPRECS, the current suggestion is to use NODUPKEY and to sort BY _ALL_

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 27857 views
  • 14 likes
  • 5 in conversation