genNthEvent function

Generate event data using longitudinal data, and restrict output to time until the nth event.