Damien Dotta
Damien Dotta

Reputation: 939

How to delete some rows within a group in SAS

I want to identify any duplicates between rows of different groups and delete some observation.

My example :

data temp;
input siren $ imput $;
cards;
x one
x one
x two
y two
y two
z three
z three
z four
;
run;

The output I want :

siren imput
x one
x one
y two
y two
z three
z three

Many thanks in advance !

Upvotes: 0

Views: 94

Answers (1)

data _null_
data _null_

Reputation: 9109

You can use PROC SORT for that.

data temp;
input siren $ imput $;
cards;
x one
x one
x two
y two
y two
z three
z three
z four
;
proc print;
   run;
proc sort data=temp out=dups nouniquekey;
   by siren imput;
   run;
proc print;
   run;

enter image description here

Upvotes: 1

Related Questions