BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
That____Redhead
Fluorite | Level 6

Hello,

I am working on an automotive client digging through their service data, and all they have provided is VIN level information with a single variable containing all work done on that Repair Order.  I am searching for Brake Replacements, but this variable is free text for the service tech to write in whatever he or she would like.

So I have 17.2 M records, of which I need to search for about 20 iterations, "Front Brake Pad" or "Rear Brake" or "Turn Rotor" or the like.  I have these set up in a %LET statement.

ex:

%LET Brakes = 'REPLACE FRONT BRAKE','REPLACE REAR BRAKE','TURN ROTOR','SURFACE BRAKE DRUM','MACHINE BRAKE ROTORS' ... ;

IF INDEXW(Description,&Brakes.) > 0;

INDEX only searches for one string

INDEXC  only will search for the first character in the string

INDEXW and FINDW says my string contains too many arguments

Can anyone suggest how I can look at this, please?

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
AncaTilea
Pyrite | Level 9

Hi.

How about this?

data want;

    set your_data;

    IF prxmatch('m/brake/oi', your_var) > 0;

run;

OR

data want;

    set your_data;

     *also keep the record that has 'turn rotor', or 'surface drum', or....(which you tell SAS by using the | delimiter);

    IF prxmatch('m/brake|turn rotor| surface drum/oi', your_var) > 0;

run;

Good luck!

Anca.

View solution in original post

2 REPLIES 2
AncaTilea
Pyrite | Level 9

Hi.

How about this?

data want;

    set your_data;

    IF prxmatch('m/brake/oi', your_var) > 0;

run;

OR

data want;

    set your_data;

     *also keep the record that has 'turn rotor', or 'surface drum', or....(which you tell SAS by using the | delimiter);

    IF prxmatch('m/brake|turn rotor| surface drum/oi', your_var) > 0;

run;

Good luck!

Anca.

That____Redhead
Fluorite | Level 6

Thanks Anca,

I'm still getting the space error - I have 18 text strings I am searching for, and it's about 350 characters long.  I'll just use this and shorten it into two PRXMATCH functions.

Thanks!         

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 choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 16155 views
  • 2 likes
  • 2 in conversation