BookmarkSubscribeRSS Feed
bits
Fluorite | Level 6
data work.systems;                                                                                                                      
set work.carsales;                                                                                                                      
if prxmatch('m/Acura|Dodge|Ford/oi',Manufacturer) > 0  then found=1;                                                                    
else found=0;                                                                                                                           
run; 

I've tried to run above code and in result I got a new dataset with found=0 only... as I want to do pattern matching so prxmatch should be there.. 

thanks:)

7 REPLIES 7
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Post test data in the form of a datastep, we can't see your data!

LaurieF
Barite | Level 11

I don't have access to your source data, but when I run

data work.systems;
set sashelp.cars;
if prxmatch('m/Acura|Quattro|Ford/oi',model) > 0
   then found=1;
   else found=0;
run; 

it works fine.

 

If you want to get fast accurrate solutions, posting the data you're using is recommended. It's fortunate there's a similar dataset in sashelp.

bits
Fluorite | Level 6

hey thanks for reply...actually im using bit old sas version i.e SAS 9.0... so does this makes any impact while running the code? @LaurieF

LaurieF
Barite | Level 11
I can't tell. It should work. But as I said, let's see your data and we'll find out.
bits
Fluorite | Level 6

here is the dataset which im using for this code @LaurieF

RW9
Diamond | Level 26 RW9
Diamond | Level 26

These are the modifier which work in 9.1,

https://support.sas.com/rnd/base/datastep/perl_regexp/regexp-tip-sheet.pdf

Sorry, 9.0 is so antiquated they had to have documentatioon on stone tablets.  Seriously, upgrade there is no benefit to staying on an old version.

LaurieF
Barite | Level 11

I'm with @RW9 - upgrade, if you're in the position to do it. If you can't, stick with multiple index or indexw calls, which will work fine.

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 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
  • 7 replies
  • 1273 views
  • 1 like
  • 3 in conversation