Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Identify latest date if before another date variable

    Hello,
    I have data where I am trying to identify the most recent conviction date if it occurred before the date of arrest. I am posting an example of the data below--the variable "max_convictdate" is what I want to produce.
    arrest_date max_convictdate convictiondate1 convictiondate2 convictiondate3 convictiondate4 convictiondate5
    26-Feb-20 13-Jan-20 17-Oct-19 17-Oct-19 13-Jan-20 13-Jan-20 10-Dec-20
    1-Jan-20 17-Oct-19 17-Oct-19 17-Oct-19 13-Jan-20 13-Jan-20 10-Dec-20
    4-Sep-20 13-Jan-20 17-Oct-19 17-Oct-19 13-Jan-20 13-Jan-20 10-Dec-20
    I've tried the following syntax based on the STATA FAQ but had no luck.
    egen maxconvict_date=rowmax(convictiondate*) if arrest_date>=convictiondate1-convictiondate5

    Any guidance is much appreciated.
    Thank you,
    Jamie
Working...
X