High-cost drugs for erectile dysfunction

Below are the database queries which are used to create this measure. These are run against a copy of the BSA prescribing data which we store in Google BigQuery. We're working on making our BigQuery tables publicly available at which point it will be possible to run and modify these queries yourself. But even where code and database queries are not directly useable by others we believe it is always preferable to make them public.

Description Prescribing of drugs which are not generic sildenafil or generic 5mg, 10mg or 20mg tadalafil tablets (from April 2018) as a percentage of prescribing of all drugs for erectile dysfunction
Why it matters The main drugs used to treat erectile dysfunction are probably equally effective (CKS 2014). Sildenafil has been significantly cheaper than other drugs, and therefore should probably be considered as the first-line agent. From April 2018 generic tadalafil 5mg, 10mg and 20mg tablets have also reduced in price considerably, and therefore have been considered as low-cost from this point onwards.
Tags Standard, Cost Saving, Erectile Dysfunction, Reproductive system
Implies cost savings No
History View change history on GitHub →

Numerator SQL

SELECT
     CAST(month AS DATE) AS month,
     practice AS practice_id,
     SUM(items) AS numerator
 FROM hscic.normalised_prescribing
 WHERE bnf_code LIKE '070405%' --Drugs For Erectile Dysfunction 
 AND  ( ( (bnf_code NOT IN 
 ('0704050Z0AAAAAA', --Sildenafil_Tab 50mg 
 '0704050Z0AAABAB',  --Sildenafil_Tab 25mg 
 '0704050Z0AAACAC')  --Sildenafil_Tab 100mg 
 AND MONTH <'2018-04-01 00:00:00') --before this point, only sildenafil was generic 
 ) OR  ( (bnf_code NOT IN 
 ('0704050Z0AAAAAA', --Sildenafil_Tab 50mg 
 '0704050Z0AAABAB',  --Sildenafil_Tab 25mg 
 '0704050Z0AAACAC',   --Sildenafil_Tab 100mg 
 '0704050R0AAAAAA',  --Tadalafil_Tab 10mg 
 '0704050R0AAABAB',  --Tadalafil_Tab 20mg 
 '0704050R0AAADAD')  --Tadalafil_Tab 5mg 
 AND MONTH >='2018-04-01 00:00:00') --after this point, Tadalafil was generic in these strengths 
 ) )
 GROUP BY month, practice_id

Denominator SQL

SELECT
     CAST(month AS DATE) AS month,
     practice AS practice_id,
     SUM(items) AS denominator
 FROM hscic.normalised_prescribing
 WHERE bnf_code IN ("0704050AAAAAAAA", "0704050AAAAABAB", "0704050AAAAACAC", "0704050AAAAADAD", "0704050AABBAAAA", "0704050AABBABAB", "0704050AABBACAC", "0704050AABBADAD", "0704050ACAAAAAA", "0704050ACAAABAB", "0704050ACAAACAC", "0704050ACBBAAAA", "0704050ACBBABAB", "0704050ACBBACAC", "0704050ADAAAAAA", "0704050ADBBAAAA", "0704050B0AAAAAA", "0704050B0AAAIAI", "0704050B0AAANAN", "0704050B0AAAVAV", "0704050B0AAAWAW", "0704050B0AAAZAZ", "0704050B0AABABA", "0704050B0AABBBB", "0704050B0AABDBD", "0704050B0AABFBF", "0704050B0AABJBJ", "0704050B0AABKBK", "0704050B0AABLBL", "0704050B0AABMBM", "0704050B0AABNBN", "0704050B0AABPBP", "0704050B0BBAAAA", "0704050B0BBABAI", "0704050B0BBACAN", "0704050B0BBADBD", "0704050B0BBAEBJ", "0704050B0BBAFBK", "0704050B0BCADAV", "0704050B0BCAEAW", "0704050B0BCAFBF", "0704050B0BCAGBL", "0704050B0BCAHBM", "0704050B0BCAIBN", "0704050B0BDABAY", "0704050B0BDACAZ", "0704050B0BDADBA", "0704050B0BDAEBB", "0704050B0BEAABP", "0704050J0AAAHAH", "0704050J0AAANAN", "0704050R0AAAAAA", "0704050R0AAABAB", "0704050R0AAACAC", "0704050R0AAADAD", "0704050R0BBAAAA", "0704050R0BBABAB", "0704050R0BBACAC", "0704050R0BBADAD", "0704050R0BDAAAB", "0704050Y0AAAVAV", "0704050Y0BCAAAV", "0704050Z0AAAAAA", "0704050Z0AAABAB", "0704050Z0AAACAC", "0704050Z0AAAEAE", "0704050Z0AAAFAF", "0704050Z0AAAGAG", "0704050Z0AAAHAH", "0704050Z0AAAIAI", "0704050Z0AAAKAK", "0704050Z0AAALAL", "0704050Z0AAAMAM", "0704050Z0AAANAN", "0704050Z0AAAPAP", "0704050Z0BBAAAA", "0704050Z0BBABAB", "0704050Z0BBACAC", "0704050Z0BDABAN", "0704050Z0BDACAP", "0704050Z0BEAAAB", "0704050Z0BEABAA", "0704050Z0BFAAAA", "0704050Z0BGAAAA")
 GROUP BY month, practice_id