- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 09-22-2009 10:10 AM
(1893 views)
Hello Everyone,
I am trying to get rid of records with duplicate key (the by value in proc sort). I tried different syntax and could never get it to work. The field ID1 is the key. I want to have unique ID1 in the outfile.
I have used:
PROC SORT; BY ID1; NODUP;
PROC SORT; BY ID1 NODUP;
none of these work. Does anyone have any suggestion?
Thank you so much!
I am trying to get rid of records with duplicate key (the by value in proc sort). I tried different syntax and could never get it to work. The field ID1 is the key. I want to have unique ID1 in the outfile.
I have used:
PROC SORT; BY ID1; NODUP;
PROC SORT; BY ID1 NODUP;
none of these work. Does anyone have any suggestion?
Thank you so much!
7 REPLIES 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PROC SORT; BY ID1; NODUPkey;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
actually NODUPKEY is a PROC statement option.
[pre]
proc sort data=sashelp.class out=sex nodupkey;
by sex;
run;
[/pre]
[pre]
proc sort data=sashelp.class out=sex nodupkey;
by sex;
run;
[/pre]
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
DATA_NULL,
That worked. Thank you so much!!
:)
That worked. Thank you so much!!
:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Flip.
I tried it with your exact syntax and got the following error:
"Statement is not valid or it is used out of proper order."
Any idea why? I am using sas version 8.2.
Thanks!
I tried it with your exact syntax and got the following error:
"Statement is not valid or it is used out of proper order."
Any idea why? I am using sas version 8.2.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Oops, yup
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Very handy adresses...
Everything you wanted to know about SAS procedures:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/procwhatsnew902.htm#
And off course, the SAS Online documentation at:
http://support.sas.com/documentation/index.html
Cheers from Portugal.
Daniel Santos @ www.cgd.pt
Everything you wanted to know about SAS procedures:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/procwhatsnew902.htm#
And off course, the SAS Online documentation at:
http://support.sas.com/documentation/index.html
Cheers from Portugal.
Daniel Santos @ www.cgd.pt
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Also, remember, for NODUP to work, the duplicate observations must be adjacent, which implicitly calls for a reasonably granular BY variable list when using the function. And, PROC SORT yields no mercy if you forget and code a BY variable list that will not achieve the required condition in order for the sort package to do its job removing duplicates.
Scott Barry
SBBWorks, Inc.
Scott Barry
SBBWorks, Inc.