BookmarkSubscribeRSS Feed
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
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>;


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


Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation