SAS Procedures

Help using Base SAS procedures
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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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