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

Hi 

 

I am trying to define 'a' that matches the following codes by using PRXPARSE: V250-V2509; V251-V2513; V254-V2549; V255-V259 

 

a= prxparse("/\b(V25[0-9]\b|\b(V250[1-9]\b|\b(V251[1-3])\b|\b(V254[0-9])\b/");

 

This generates an error message saying: 

 

 ERROR: Unmatched ( before HERE mark in regex m/\b(V25[0-9]\b|\b( << HERE V250[1-9]\b|\b(V251[1-3])\b|\b(V254[0-9])\b/

 

Can someone help me resolving this issue? 

 

Thanks in advance for your time!

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Try

 

a= prxparse("/\b(V250[1-9]?|V251[1-3]?|V254[1-9]?|V25[5-9])\b/");

 

 

PG

View solution in original post

4 REPLIES 4
PGStats
Opal | Level 21

Try

 

a= prxparse("/\b(V250[1-9]?|V251[1-3]?|V254[1-9]?|V25[5-9])\b/");

 

 

PG
jhs2171
Obsidian | Level 7

Thank you so much for the quick reply! I just tried what you suggested and it ran! Quick question. So I've noticed that you tweaked a few things- you changed the order of the sequence (4 digits -> 3 digits instead of 3 digits ->4 digits) and I see question marks between [ ] and |. I am guessing the question mark did the trick?! 

 

You also changed the range from 0-9 to 1-9 etc. but I am guessing that's just a typo as it is irrevant to the question I was asking. Thanks so much!!!

 

 

 

 

 

PGStats
Opal | Level 21

? means none or one match. 

 

V250[1-9]? will match V250, V2501, V2502... V2509

 

V250[0-9]? will match V250, V2500, V2501, V2502 ... V2509

 

Your pick.

PG
jhs2171
Obsidian | Level 7

Oh I see. I noticed that the last one (V25[4-9]) does not have ? at the end, but I tried both w. and wo it and they returned the same result-  So what was the prob with my code then? I thought it was something to do w. 'V'.   Thanks again for your help!! 

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
  • 4 replies
  • 952 views
  • 0 likes
  • 2 in conversation