The data I am working on are pharmacy claims and unfortunately, for some of the more complicated dosages like: Acetaminophen w/ Codeine Soln 120-12 MG/5ML, there is no dosage unit information. I am looking to extract the 12 MG/5ML portion so I can calculate the MG/ML amount for further calculations. I've tried using SCAN, but it's not feasible to specificy the exact string since some of the names have shorter or longer number of strings. Is there another method I can use or is there an available list somewhere that generates the dosage per ML I don't know about?
data have; infile cards truncover; input x $100.; cards; Acetaminophen w/ Codeine Soln 120-12 MG/5ML, there is no dosage unit information ; run; data want; set have; pid=prxparse('/\d+\s*MG\/\d+ML/i'); s=1; e=length(x); call prxnext(pid,s,e,x,p,l); do while(p>0); found=substr(x,p,l); output; call prxnext(pid,s,e,x,p,l); end; keep found; run;
Is there a consistent pattern to your data such as the - character between the drug description and the dosage information?
If so then SCAN would work if that is the only hyphen:
drugName= scan(variable,'-',1);
doseInfo = scan(variable,'-',2);
I have worked with just enough drug information to sympathize with likely to be poorly structured data.
Yes, exactly. I ended up finding a calculator developped by Prescription Drug Monitoring Program Training and Technical Assistance Center (PDMP TTAC) that has a spreadsheet within the tool with the dosage strength information for patches, solutions, etc for opioids.
I think all of the drug name info. are formated like that, yes. So although I did find a shortcut with the tool, I will try the scan method which might help for all drug classes, not just opioids. Thank you.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.