Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72767

generating a new variable that indicates if the last event is a 1 or a 2

$
0
0
Hello List
I have a data set with id, event_date, event_code(0 or 1)
for every id there can be more than one event.
So data look like:

id event_date event_code
01 01/01/01 1
01 01/06/01 2
01 01/01/02 1
02 01/08/09 1

I want to generate a variable that shows me if the last event is a 1 or a 2, the number of events vary from 1 to 16

hope you can help me here.

Viewing all articles
Browse latest Browse all 72767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>