I have looked around for ages trying to find what I am looking for but none of the code has given me what I want. I need to create a variable that calculates the difference in months between two date variables.
For example, if I have the data below:
start_date end_date
2010-01-01 2010-12-31
2016-05-01 2016-12-31
2004-03-01 2004-10-31
1997-10-01 1998-08-31
I would like the outcome to look like the following:
start_date end_date month_count
2010-01-01 2010-12-31 12
2016-05-01 2016-12-31 8
2004-03-01 2004-10-31 8
1997-10-01 1998-08-31 11
Meaning I would like the whole last month to be included. Many of the codes I have checked have given me 11 months for the first observation instead of 12 for example. Also, many codes have said to specify the actual date but as I have a large dataset I can't do that, and would need to go by the variables instead.
Thank you in advance!