From the screenshot how can I find max cr between admitdate and disdate
Thank you
egen max = max(disdate-admitdate)
summarize datediff
egen max = max(cr), by(admitdate)
clear
input float(date cr)
42616 .3488717
42617 .2668857
42618 .1366463
42619 .028556867
42620 .8689333
42621 .3508549
42622 .07110509
42623 .32336795
42624 .5551032
42625 .875991
end
* Find max of cr in a window of 15 dates
asrol cr, stat(max) window(date 15) min(14)
+----------------------------------+
| date cr cr_max15 |
|----------------------------------|
1. | 04sep2076 .2047095 . |
2. | 05sep2076 .8927587 . |
3. | 06sep2076 .5844658 . |
4. | 07sep2076 .3697791 . |
5. | 08sep2076 .8506309 . |
|----------------------------------|
6. | 09sep2076 .3913819 . |
7. | 10sep2076 .1196613 . |
8. | 11sep2076 .7542434 . |
9. | 12sep2076 .6950234 . |
10. | 13sep2076 .6866152 . |
|----------------------------------|
11. | 14sep2076 .9319346 . |
12. | 15sep2076 .4548882 . |
13. | 16sep2076 .0674011 . |
14. | 17sep2076 .3379889 .9319346 |
15. | 18sep2076 .9748848 .97488481 |
|----------------------------------|
16. | 19sep2076 .7264384 .97488481 |
17. | 20sep2076 .0454151 .97488481 |
18. | 21sep2076 .7459667 .97488481 |
19. | 22sep2076 .4961259 .97488481 |
20. | 23sep2076 .7167162 .97488481 |
|----------------------------------|
21. | 24sep2076 .859742 .97488481 |
22. | 25sep2076 .1340756 .97488481 |
23. | 26sep2076 .4884419 .97488481 |
24. | 27sep2076 .8712187 .97488481 |
25. | 28sep2076 .7664683 .97488481 |
|----------------------------------|
26. | 29sep2076 .2512555 .97488481 |
27. | 30sep2076 .1663648 .97488481 |
28. | 01oct2076 .7437958 .97488481 |
29. | 02oct2076 .9805113 .98051131 |
30. | 03oct2076 .7295772 .98051131 |
|----------------------------------|
31. | 04oct2076 .9011049 .98051131 |
32. | 05oct2076 .2643649 .98051131 |
33. | 06oct2076 .8856509 .98051131 |
34. | 07oct2076 .882112 .98051131 |
35. | 08oct2076 .748933 .98051131 |
|----------------------------------|
36. | 09oct2076 .9196262 .98051131 |
37. | 10oct2076 .6934533 .98051131 |
38. | 11oct2076 .2154026 .98051131 |
39. | 12oct2076 .8285888 .98051131 |
40. | 13oct2076 .0442154 .98051131 |
|----------------------------------|
41. | 14oct2076 .8630378 .98051131 |
42. | 15oct2076 .3526046 .98051131 |
43. | 16oct2076 .7720399 .98051131 |
44. | 17oct2076 .5861199 .91962624 |
45. | 18oct2076 .3227766 .91962624 |
|----------------------------------|
46. | 19oct2076 .1729307 .91962624 |
47. | 20oct2076 .8053644 .91962624 |
48. | 21oct2076 .3060019 .91962624 |
49. | 22oct2076 .2190997 .91962624 |
50. | 23oct2076 .724731 .91962624 |
+----------------------------------+
Comment