BookmarkSubscribeRSS Feed
appleorange
Obsidian | Level 7

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?

3 REPLIES 3
Ksharp
Super User

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;

ballardw
Super User

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.

 

appleorange
Obsidian | Level 7

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1190 views
  • 2 likes
  • 3 in conversation