BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10

Hi Guys,

how to remove duplicate values using proc summary and proc tabulate give example 

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

Why do you want to use either of those to remove duplicates in your data?

BrahmanandaRao
Lapis Lazuli | Level 10
for best practice
Kurt_Bremser
Super User

Best practice is to use PROC SORT with NODUPKEY, a DATA step with FIRST. or LAST., or SQL with DISTINCT, depending on your data structure and the details of your needs.

(PS if that was an interviewer's question, he/she wants the above as answer; the fact that you even think about trying such stupidity during an interview immediately exposes you as a SAS noob).

ballardw
Super User

@BrahmanandaRao wrote:

Hi Guys,

how to remove duplicate values using proc summary and proc tabulate give example 


Proc SUMMARY summarizes numeric values and could be done so for groups of BY or Class variables. Not really removing duplicates.

Proc tabulate by default creates a report for people to read and removes nothing and the output data sets created by Proc tabulate are structured quite a bit differently than you might expect, not a good tool for "removing duplicates" in my opinion but useful for certain restructuring issues. Additionally since Proc Tabulate can have multiple Table descriptions in a single procedure the output data set can be quite complicated.

 

So a very explicit detailed example of starting data and desired result are needed to properly answer a question.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 770 views
  • 1 like
  • 4 in conversation