SAS: how to bring values in the next couple of rows to the current row but don't know how far down to look
问题 I have a data set that tracks the location change for a person. The data set includes person ID, a serial number for records within person ID, start datetime for the current location, leave datetime for this location, current location code and the prior location code. My goal is to reorganize the data set so that I know on each row for a location how long the person actually stayed and the rows should still stay in the order ofdate/time ascending. see a snippet of the data set for example