DATA Step, Macro, Functions and more

select last observation

Reply
Occasional Contributor
Posts: 5

select last observation

Hi all, this is probably relatively simple, but appreciate the help.

 

data I have

 

id       event        value

1            a               x

1            b               y

1            c               z

2            a               q

2            b               r

2            c               s

2            d               t

...

 

data i want

 

id          event       value

1             c               z

2             d               t

Super User
Posts: 17,930

Re: select last observation

Use BY groups and first/last in SAS.

 

data want;
set have;
by id;
if last.id;
run;
Ask a Question
Discussion stats
  • 1 reply
  • 191 views
  • 0 likes
  • 2 in conversation