Hello Experts,
I have a file with duplicate values and the same data with no duplicate values. I can import the 2 files. Do you know please how to find the key of sorting ?
Thank you !
I am sure that i don't understand your problem.
If you use proc sort with "presorted" options, sas will only sort the dataset if it is not already sorted by the variable you provide.
@SASdevAnneMarie Put yourself into our shoes and assume you read below without any further information and context:
I have a file with duplicate values and the same data with no duplicate values. I can import the 2 files. Do you know please how to find the key of sorting ?
...and now that you understand please try and provide all the necessary information so we can help you to help yourself.
It sounds like you have one data set that is unsorted and you want to check whether the unique values in the data match a specified set of "target" values, which are in a second data set. To do that you can use PROC SORT with the NODUP option and compare the output to the set of "target" values:
/* orig data */
data Have;
input x @@;
datalines;
4 3 2 5 6 4 3 2 2 2 3 5 4 7
;
proc sort data=Have nodup out=Want;
by x;
run;
/* unique values ("target" values) that we want to compare against */
data Unique;
input x @@;
datalines;
2 3 4 5 6 7
;
proc compare base=Unique compare=Want;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.