This query is used to to provide summary statistics for costs paid by coinsurance (paid_coinsurance) across all drug cost records: the mean, the standard deviation, the minimum, the 25th percentile, the median, the 75th percentile, the maximum and the number of missing values. No input is required for this query.
WITH tt as (
SELECT c1.paid_patient_coinsurance AS stat_value
, ROW_NUMBER() OVER (ORDER BY c1.paid_patient_coinsurance) order_nr
, (SELECT COUNT(*)::integer FROM @cdm.cost WHERE paid_patient_coinsurance > 0) AS population_size
FROM @cdm.cost c1
WHERE c1.paid_patient_coinsurance > 0
)
SELECT MIN(tt.stat_value)::numeric AS min_value
, MAX(tt.stat_value)::numeric AS max_value
, AVG(tt.stat_value)::numeric AS avg_value
, (ROUND(STDDEV(tt.stat_value), 0)::numeric ) AS STDEV_value
, MIN(CASE WHEN order_nr < .25 * population_size THEN 9999 ELSE stat_value END) AS percentile_25
, MIN(CASE WHEN order_nr < .50 * population_size THEN 9999 ELSE stat_value END) AS median_value
, MIN(CASE WHEN order_nr < .75 * population_size THEN 9999 ELSE stat_value END) AS percentile_75
FROM tt;
None
| | | --- | | Field | Description | | min_value | The portion of the drug expenses due to the cost charged by the manufacturer for the drug, typically a percentage of the Average Wholesale Price. | | max_value | | | avg_value | | | STDEV_value | |
| Field | Description | | --- | --- | | min_value | | | max_value | | | avg_value | | | STDEV_value | |
https://github.com/OHDSI/CommonDataModel/wiki/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.