Help using Base SAS procedures

Removing duplicates

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,041
Accepted Solution

Removing duplicates

Hi Team,

For the same ID I dont want duplicate DATETIME values by the TYPE??

I tried and it was confusing

Thanks for the help

HAVE

ID      TYPE     DATETIME

101    IN         02MAY12:45

101   OUT     02MAY16:05

101   OUT    02MAY16:05

101  IN        02MAy12:45

101  IN       06MAy12:42

101  IN      06MAy12:42

WANT

ID      TYPE     DATETIME

101    IN         02MAY12:45

101   OUT     02MAY16:05

101  IN         06MAy12:42


Accepted Solutions
Solution
‎08-16-2013 03:31 PM
Super Contributor
Posts: 1,636

Re: Removing duplicates

Posted in reply to robertrao

proc sort data=have;

by id datetime;

data want;

set have;

by id datetime;

if first.datetime;

run;

View solution in original post


All Replies
Solution
‎08-16-2013 03:31 PM
Super Contributor
Posts: 1,636

Re: Removing duplicates

Posted in reply to robertrao

proc sort data=have;

by id datetime;

data want;

set have;

by id datetime;

if first.datetime;

run;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 153 views
  • 0 likes
  • 2 in conversation