Hi,
I want to calculate the fractional months between different observations from the prior observations with the same key. For example, for the observations with the key "111", I want to calculate the fractional months seen in Counter "2" vs Counter "1", then the fractional month seen in Counter "3" vs Counter "2", then Counter "4" vs Counter "2", then start over again for next key "118". In excel, it would be like using the formula =DATEDIF(D7,D8,"M")+DATEDIF(D7,D8,"MD")/(365/12). Below is an example of the data set and I want to create the "Months btw Dates" column below. Thanks in advance!
Obs
Key
Counter
Date
Months btw Dates
1
111
1
1/1/2023
2
111
2
2/5/2023
1.13
3
111
3
4/7/2023
2.07
4
111
4
6/10/2023
2.10
5
118
1
2/10/2023
6
118
2
5/1/2023
2.69
... View more