Hello,
My dataset looks something like below: (Data is confidential so I'm not using dataex command)
The idea is that each individual (id) has an offense date (off_date) when they were arrested. Each arrest could have multiple offenses associated with it. This results in multiple observations (rows) of a single person getting arrested once, since the data is at offense level instead of offense date. I would like to create a variable that basically counts each arrest instead of each offense. I tried to do the bysort egen option, but it leads to numbering the offenses per offense date. What I would like is the offense dates per individual. I did try to look up responses on this but I'm afraid I'm looking up the wrong keywords or search text as I am unable to find a solution so far. Also, I can not use the keep if _n==1 option since I still need the whole dataset as is.
Thank you,
Tessie
My dataset looks something like below: (Data is confidential so I'm not using dataex command)
Code:
clear input double(id off_date offense) 1 20129 41 1 17183 22 1 17183 12 2 21642 7 2 17275 12 2 21642 41 3 16490 41 4 16502 12 5 17279 22 5 18385 37.8 end
Thank you,
Tessie
Comment