Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
71 views
in Technique[技术] by (71.8m points)

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 !

question from:https://stackoverflow.com/questions/65848148/how-to-delete-some-rows-within-a-group-in-sas

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...