Hello,
I am trying to use a date variable to calculate the difference between two dates. I am trying to see the difference between the first and last observation for a given ID, but sometimes there are more than 2 observations per individual. Take the sample data below:
ID DateStamp
1 01AUG2020
1 07SEP2020
2 01AUG2020
2 08AUG2020
2 11SEP2020
3 05JUN2020
3 01AUG2020
I want to end up with a variable that is the date difference between the first ID entry and the last ID entry (for example, for ID #1, the date variable would be the difference between September 7 and August 1, for ID #2, the date variable would be the difference between August 1 and September 11, etc).
Can someone help me with this?
Thank you!