☑ This topic is solved.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 02-03-2023 03:12 PM
(1495 views)
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks!