I have a health data set that has 1078 individuals and 75 variables and spans 7 years. Each individual is expected to attend a health service three times a week. I want to create a weekly attendance rate but some individuals have missing days and weeks. I have tried creating a calendar of individual days and using 'cross' to input the missing dates into a minimised data set of 2 years and just 4 variables but ended up with 63million observations. I also tried joinby (using the admission date in the using dataset) and 'update' option but that did not fill in the missing dates.
Thanks for any assistance
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id double(adm_date sep_date) float(year stdyenddt) 1 17715 17717 2008 18427 1 17721 17721 2008 18427 1 18165 18172 2009 18427 1 18175 18186 2009 18427 1 18191 18191 2009 18427 1 18193 18193 2009 18427 1 18196 18196 2009 18427 1 18197 18198 2009 18427 1 18200 18200 2009 18427 1 18203 18203 2009 18427 1 18205 18205 2009 18427 1 18207 18207 2009 18427 1 18210 18210 2009 18427 1 18212 18212 2009 18427 1 18216 18266 2009 18427 end format %td adm_date format %td sep_date format %td stdyenddt
0 Response to Entering missing calendar dates
Post a Comment