Count distribution of length of observation, in months, among first observation periods across the population.
Input:
<None>
Sample query run:
The following is a sample run of the query.
SELECT DATEDIFF(month, observation_period_start_date, observation_period_end_date) 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 observation_period) OP1
WHERE op_number = 1
GROUP BY DATEDIFF(month,observation_period_START_DATE, observation_period_END_DATE)
ORDER BY DATEDIFF(month,observation_period_START_DATE, observation_period_END_DATE) ASC
Output:
Output field list:
Field |
Description |
num_month |
Number of month duration |
num_persons |
Number of patients whose observation period with num_month duration |
Sample output record:
Field |
Value |
num_month |
10 |
num_persons |
624314 |
|
|