BookmarkSubscribeRSS Feed
Amit_91
Calcite | Level 5

Hi,

I would need your help on the issue:

I have a dataset with 1000 drug names and I want to pattern match those drug names with the main Pharmacy Data set so that I can only get data for the drugs I have. Hard coding 1000 values is not an option here, so i'm looking for a dynamic solution.

Both the tables have Generic Name column and I want to pattern match on these two. I want to use wildcard operator.

 

Could someone please help?

 

Thanks!

6 REPLIES 6
ed_sas_member
Meteorite | Level 14

Hi @Amit_91 

 

Could you please supply some datalines in a usable form (data step) to play with and provide you with a useful solution?

 

Best,

Amit_91
Calcite | Level 5

data drugs;
infile datalines dlm='+';
length generic_name $ 50;
input generic_name $ ;
datalines;
CERTOLIZUMAB
GOLIMUMAB
ABATACEPT
run;

Above are only 3 drugs but i might have 1000 drugs. And i want to match these drugs with the main pharmacy table using wildcard.

biopharma
Quartz | Level 8
This is good but only a beginning. Can you give us similarly what is in the main pharmacy table and what you look to match? People work across a number of industries and every industry data is different. If we can't see your problem, how can we write any code to solve it? You will need to provide:

1. Code to generate Drugs dataset (you have provided)
2. Code to generate Pharmacy dataset
3. Resulting dataset
ballardw
Super User

Please be very specific on your matching requirements.

Drugs are one area where wildcards may be a poor choice because of compound names where some names are part of several others and to some extent the composition  (liquid for injection or pills for example).

Amit_91
Calcite | Level 5

Hey,

 

I want to check only oral tablets. And I want to match the drugs in my table from the main Pharmacy data set using wildcard.

 

Thanks,

Amit

DavePrinsloo
Pyrite | Level 9

Could you please give an example where you are using a wildcard.   The names you give as examples do not contain wildcards!

 

Maybe you should consider using the COMPGED function.   

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 516 views
  • 0 likes
  • 5 in conversation