SAS Programming

DATA Step, Macro, Functions and more
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!

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

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
  • 1496 views
  • 3 likes
  • 2 in conversation