inst/QueryLibrary/Aggregate/drug_era/DER03.md

DER03: What is the number of distinct ingredients per patient?

Description

Average number of distinct ingredients for all patients.

Query

SELECT
        avg(cnt)
from
        (
                select
                        count(distinct r.drug_concept_id) cnt,
                        r.person_id
                FROM
                        @cdm.drug_era r
                GROUP BY
                        r.person_id
        ) a

Input

None

Output

| Field | Description | | --- | --- | | avg | Average count of distinct ingredient for all patients |

Example output record

| Field | Value | | --- | --- | | avg | 10 |

Documentation

https://github.com/OHDSI/CommonDataModel/wiki/



sib-swiss/dsQueryLibraryServer documentation built on Feb. 13, 2025, 8:07 p.m.