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
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;
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.