Help using Base SAS procedures

Extracting dosage amount from generic drug name

Reply
Occasional Contributor
Posts: 14

Extracting dosage amount from generic drug name

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?

Super User
Posts: 10,041

Re: Extracting dosage amount from generic drug name

Posted in reply to appleorange

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;

Super User
Posts: 11,343

Re: Extracting dosage amount from generic drug name

Posted in reply to appleorange

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.

 

Occasional Contributor
Posts: 14

Re: Extracting dosage amount from generic drug name

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.

Ask a Question
Discussion stats
  • 3 replies
  • 213 views
  • 2 likes
  • 3 in conversation