Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72768

How to calculate duration

$
0
0
Hello,

I want to calculate # of months with insurance.
The table below is for one person's records including start date and termination date.
I'd like to create # of months with insurance each year.
mem_effdate mem_termdate
1-Jun-10 31-May-11
1-Jun-11 30-Jun-11
1-Jul-11 31-May-12
1-Nov-11 30-Jun-12
1-Jun-12 31-May-13
1-Jul-12 30-Jun-13
1-Jun-13 31-May-15
1-Jul-13 30-Jun-14
1-Jul-14 31-Jan-43
1-Jun-15 31-May-16

For this case, the final data that I want to have looks like below:
insu_2010 insu_2011 insu_2012 insu_2013 insu_2014 insu_2015
6 12 12 12 12 12

The red-colored year, 2043, can be interpreted as 2017.
Would you help me how to calculate # of months each year?

This is the 1st time I used dataex saved for Stata version 11 or 12. Array
Let me know if something is wrong with the data.

I deeply appreciate your help in advance,

Soyeon

Viewing all articles
Browse latest Browse all 72768

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>