BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SpecBurns
Calcite | Level 5

Hi there, 

 

I'm trying to clean some data by deleting observations that were entered twice - however, these were assigned unique identifiers that I need to keep for linkage purposes.   Essentially I want to run a nodupkey and sort by all variables with the exception of the observation ID's.  Is there a way to add an exception to the by_all_ command?  Something like by_all_ except obs_id ?

 

e.g., 

proc sort data = original_data out = dups_removed nodupkey;

     by_all_;

run;

 

Thanks!

Spec

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

No.

But it is not hard to generate the actual list.

proc transpose data=original_data(drop=obs_id obs=0) out=names; var _all_; run; 
proc sql noprint; select nliteral(_name_) into :names separated by ' ' from names; quit;
proc sort data=original_data out=dups_removed nodupkey;
  by &names;
run;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

No.

But it is not hard to generate the actual list.

proc transpose data=original_data(drop=obs_id obs=0) out=names; var _all_; run; 
proc sql noprint; select nliteral(_name_) into :names separated by ' ' from names; quit;
proc sort data=original_data out=dups_removed nodupkey;
  by &names;
run;
SpecBurns
Calcite | Level 5
Thanks!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1941 views
  • 3 likes
  • 2 in conversation