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

 

Could someone kindly tell me what this regular expression "(prxmatch(/[#]/,&path.))=0" means?

 

%if %sysfunc(prxmatch(/[#]/,&path.))=0 %then %do;

with a concrete case will be better.thank you for your time

 

1 ACCEPTED SOLUTION

Accepted Solutions
gamotte
Rhodochrosite | Level 12

Hello,

 

I would say that the square brackets here are useless and the regex is only used to

test whether the path macrovariable contains a hash sign.

 

234  %macro regexp(path);
235  %if %sysfunc(prxmatch(/[#]/,&path.))=0 %then %do;
236     %put OK;
237  %end;
238  %else %do;
239     %put KO;
240  %end;
241  %mend;
242
243  %regexp(c:/temp);
OK
244  %regexp(c:/temp/file#1);
KO

[list of characters] matches any character in the list.

 

View solution in original post

1 REPLY 1
gamotte
Rhodochrosite | Level 12

Hello,

 

I would say that the square brackets here are useless and the regex is only used to

test whether the path macrovariable contains a hash sign.

 

234  %macro regexp(path);
235  %if %sysfunc(prxmatch(/[#]/,&path.))=0 %then %do;
236     %put OK;
237  %end;
238  %else %do;
239     %put KO;
240  %end;
241  %mend;
242
243  %regexp(c:/temp);
OK
244  %regexp(c:/temp/file#1);
KO

[list of characters] matches any character in the list.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 571 views
  • 0 likes
  • 2 in conversation