BookmarkSubscribeRSS Feed
SASdevAnneMarie
Barite | Level 11

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 !

4 REPLIES 4
andreas_lds
Jade | Level 19

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.

Patrick
Opal | Level 21

@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.

SASdevAnneMarie
Barite | Level 11
Hello Patrick,
I mean that I would like to do the proc compare between sorted and not sorted data. But I don’t know if proc compare can indicate the duplicate values. Thank you for your help.
Rick_SAS
SAS Super FREQ

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;
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
  • 4 replies
  • 1027 views
  • 2 likes
  • 4 in conversation