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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1791 views
  • 0 likes
  • 3 in conversation