BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
If i have a table with 10 columns, an entry is a duplicate if except the first two variables, the rest variable have the same input
How to write a program to identify the no of duplicates in this table
1 REPLY 1
ballardw
Super User

You have not bothered to describe the data at all. How many of those columns are numeric ? How many are character?

How do you want to describe "duplicate"? Add a variable to the data? If so, what values should it take?

Or subset the data set?

 

If the values of variables are all numeric then the RANGE function MIGHT be the easiest approach:

 

data junk;

   set have;

   array v(*) <your variables go here>;

   if range(of v(*))=0 then <do whatever you want when all the same>;

run;

However, if you have mixes of missing values and actual values that  would require adding a check that the nonmissing values equal the number of variables (i.e. the N function).

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

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
  • 1 reply
  • 320 views
  • 0 likes
  • 2 in conversation