Drug Era‎ > ‎

DER26: Counts of genders, stratified by drug

This query is used to count all genders (gender concept_id), stratified by drug (drug_concept_id). The input to the query is a value (or a comma-separated list of values) of a gender_concept_id and a drug_concept_id. If the input is ommitted, all existing value combinations are summarized.

Input:
 Parameter  Example  Mandatory  Notes
list of gender_concept_id 8507, 8532 Yes Male, Female
list of drug_concept_id 1300978, 1304643, 1549080 Yes

Sample query run:
The following is a sample run of the query. The input parameters are highlighted in blue

SELECT 
  p.gender_concept_id,
  count(1) as stat_value,
  
                   t.drug_concept_id

FROM       drug_era t,
     
                   person p

where      
   t.drug_concept_id in (1300978, 1304643, 1549080) 
                   and
  p.person_id = t.person_id and
  p.gender_concept_id in (8507, 8532) 
GROUP BY  t.drug_concept_id, 
                   p.gender_concept_id
order by t.drug_concept_id, 
                   p.gender_concept_id
 ;
Output:
Output field list:
 Field  Description
gender_concept_id
stat_value
drug_concept_id
gender_concept_id

Sample output record:
 Field  Description
gender_concept_id
stat_value
drug_concept_id
gender_concept_id
Comments