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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 465 views
  • 0 likes
  • 2 in conversation