CMS 2008 Basic Stand Alone (BSA) Prescription Drug Events (PDE) Public Use Files
Data Source
These datasets describe randomly extracted (5%) Prescription Drug Events/Claims. Drug costs from therapeutic area and drug.
Here described is:
By therapeutic categories and brand/generic, the total cost and the unit drug cost are described. In terms of total costs, Central nervous systm, Cardiovascular and Hormonal agents were the top 3 categories. In terms of unit drug costs, Diagnostic, Immunological and Antineoplastic agents were the top 3 categories.
#Echo set to FALSE with following read file processes
#claims <- foreach(i=1:length(fileName), .combine=rbind) %do%{read_csv(fileName[i], col_names = TRUE)}
#drugName <-read_csv("DRUG_NAME_TABLE.csv")
#drugClass <-read_csv("DRUG_CLASS_TABLE.csv")
#------- The Cost of Brand and Generic Drugs --------------
summary_1 <- claims %>% group_by(PDE_DRUG_TYPE_CD,PDE_DRUG_CLASS_CD) %>% select(PDE_DRUG_CLASS_CD,PDE_DRUG_TYPE_CD, PDE_DRUG_COST, PDE_DRUG_QTY_DIS) %>% summarise(Number_of_Prescriptions_Events = n(),Total_Cost= sum(PDE_DRUG_COST),
Total_Quntity = sum(PDE_DRUG_QTY_DIS) ) %>% arrange(desc(Number_of_Prescriptions_Events)) %>% data.frame()
#Replace codes with Drug Name and Drug Codes
drug_type<-foreach(i=1:dim(summary_1)[1], .combine=c) %do% {
if(summary_1[i,1]==0) "Unknown"
else if(summary_1[i,1]==1) "Brand"
else if(summary_1[i,1]==2) "Generic"}
summary_1$PDE_DRUG_TYPE_CD <- drug_type
drug_class<- foreach(i=1:dim(summary_1)[1], .combine=c) %do% {
drugClass$NDF_VA_MAJOR_CLASS[which(drugClass$PDE_DRUG_CLASS_CD ==
summary_1$PDE_DRUG_CLASS_CD[i])]}
drug_class[is.na(drug_class)]<-"Unknown"
summary_1$PDE_DRUG_CLASS_CD <- drug_class
summary_1$Cost_per_unit <- summary_1$Total_Cost/summary_1$Total_Quntity
names(summary_1)[1:2]<-c("Brand_Generic", "Therapeutic_Class")
Total drug cost by therapeutic category
summary_1 %>% ggplot(aes(Therapeutic_Class, Total_Cost/10^6, color=Brand_Generic))+geom_bar(stat = "identity")+theme(axis.text.x = element_text(angle = 90, hjust = 1))+ylab("Million USD")

Unit drug cost by therapeutic category
summary_1 %>% ggplot(aes(Therapeutic_Class, Cost_per_unit,color=Brand_Generic))+geom_bar(stat = "identity")+theme(axis.text.x = element_text(angle = 90, hjust = 1))+ylab("USD")
