I have written a new package, survcollapse, to help collapse disease surveillance (or similar) datasets.
Surveillance data often include one or multiple cases per calendar day. survcollapse ensures that the resulting time series is complete: time units (e.g., days) that are missing in the original dataset are automatically created, assigned zero cases, and flagged.
survcollapse is not a replacement for collapse. It aggregates case counts by summing a case (disease) variable within groups defined by user-selected variables. It can also generate time variables corresponding to daily time or to weekly time using Stata weeks, ISO weeks, or CDC epidemiologic weeks.
To install from SSC:
ssc install survcollapse
Example (collapse line-list data to a complete daily series by province):
survcollapse, datevar(date) casevar(cases) keepvars(province) saving(daily_cases, replace)
The goal is to expedite the creation of collapsed surveillance datasets by variables of interest (e.g., province, age group, sex), while preserving a complete time axis.
Surveillance data often include one or multiple cases per calendar day. survcollapse ensures that the resulting time series is complete: time units (e.g., days) that are missing in the original dataset are automatically created, assigned zero cases, and flagged.
survcollapse is not a replacement for collapse. It aggregates case counts by summing a case (disease) variable within groups defined by user-selected variables. It can also generate time variables corresponding to daily time or to weekly time using Stata weeks, ISO weeks, or CDC epidemiologic weeks.
To install from SSC:
ssc install survcollapse
Example (collapse line-list data to a complete daily series by province):
survcollapse, datevar(date) casevar(cases) keepvars(province) saving(daily_cases, replace)
The goal is to expedite the creation of collapsed surveillance datasets by variables of interest (e.g., province, age group, sex), while preserving a complete time axis.
