BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cmemtsa
Quartz | Level 8

Hi,

 

I have this set of data

ID_A          COL_ID        AMOUNT_A  AMOUNT_B
1                  1_1                       100               110
1                   1_2                     200                210
1                  1_3                      200              210
1                   1_4                      300              310
1                    1_5                      300              310
2                    2_1                        50               55
3                     3_1                       60               65

 

The rows 2 / 3 and 4 / 5 are duplicates in all fields apart from field COL_ID. In these cases, I want to extract the first row i.e.

the following output.

 

ID_A   COL_ID   AMOUNT_A      AMOUNT_B
1         1_1        100                        110
1          1_2        200                      210
1         1_4        300                      310
2         2_1          50                        55
3        3_1           60                        65

 

Is this possible?

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star
Try:

proc sort data=have;
by ID_A amount_a amount_b;
run;

data want;
set have;
by ID_A amount_a amount_b;
if first.amount_b;
run;

proc sort data=want;
by ID_A col_id;
run;

View solution in original post

2 REPLIES 2
Astounding
PROC Star
Try:

proc sort data=have;
by ID_A amount_a amount_b;
run;

data want;
set have;
by ID_A amount_a amount_b;
if first.amount_b;
run;

proc sort data=want;
by ID_A col_id;
run;
cmemtsa
Quartz | Level 8
It works. Thank you.