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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 16124 views
  • 2 likes
  • 2 in conversation