Count distribution of length of observation, in months, among first observation periods across the population.
SELECT
FLOOR(DATEDIFF(day, observation_period_start_date, observation_period_end_date)/30) AS num_months,
COUNT(DISTINCT person_id) AS num_persons
FROM
( SELECT
person_ID,
observation_period_START_DATE,
observation_period_END_DATE,
rank() OVER (PARTITION BY person_ID ORDER BY observation_period_START_DATE ASC) AS OP_NUMBER
FROM @cdm.observation_period
) AS OP1
WHERE op_number = 1
GROUP BY FLOOR(DATEDIFF(day,observation_period_START_DATE, observation_period_END_DATE)/30)
ORDER BY FLOOR(DATEDIFF(day,observation_period_START_DATE, observation_period_END_DATE)/30) ASC
;
None
| Field | Description | | --- | --- | | num_month | Number of month duration | | num_persons | Number of patients whose observation period with num_month duration |
| Field | Value | | --- | --- | | num_months | 1 | | num_persons | 4132770 |
https://github.com/OHDSI/CommonDataModel/wiki/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.