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

I'm looking to extract IBAN numbers from some SWIFT data I have, but my PRXMATCH function doesn't seem to be working, does anyone know why?

 

An example of the text field I'm searching in would be:

LV05AIZK1234567891234  COMPANY NAME ADDRESS

 

In order to find the starting character for the match to use in a substring extract, I'm using:

PRXMATCH('/\LV\d{2}\D{4}\d{13}\s/', COLUMN)

 

This looks right to me but I keep getting a result of zero where I can see this IBAN form in the data.

1 ACCEPTED SOLUTION

Accepted Solutions
FredrikE
Rhodochrosite | Level 12

This seemes to work 🙂

 

data one;
length iban $32 column $200;
column = 'One IBAN Number: LV05AIZK1234567891234 COMPANY NAME ADDRESS';
pos = PRXMATCH('/LV\d{2}\D{4}\d{13}/', COLUMN);
run;

 

I removed the first \ and the trailing \s.....

 

//Fredrik

View solution in original post

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Would not scan(string,1," ") not work?

ICL1986
Fluorite | Level 6

That's a much neater solution for this particular problem thanks. For instances where the IBAN can potentially be anywhere in the string, can you think what's wrong the the PRXPARSE statement? 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, I am not familiar with Perl so much, so will let others comment on that.  If it always starts with "LV" and length 21 which your regex seems to indicate then:

want=substr(thestring,index(thestring,"LV"),21);

So find LV in the string, and then substr out 21 characters from there.

ICL1986
Fluorite | Level 6

Perfect, thanks

FredrikE
Rhodochrosite | Level 12

This seemes to work 🙂

 

data one;
length iban $32 column $200;
column = 'One IBAN Number: LV05AIZK1234567891234 COMPANY NAME ADDRESS';
pos = PRXMATCH('/LV\d{2}\D{4}\d{13}/', COLUMN);
run;

 

I removed the first \ and the trailing \s.....

 

//Fredrik

ICL1986
Fluorite | Level 6

Yes, this works now thanks

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 2337 views
  • 0 likes
  • 3 in conversation