Hi Experts,
some of the praxmatch are not working for some regular expressions.
Could you please tell me whats wrong with the regular expressions where it is not working.
data test;
input StudyEventKey:$40.;
x = prxmatch(prxparse('/^VIST\[*\]*V*\[*\]/') ,StudyEventKey); /*Does not work*/
x1 = prxmatch(prxparse('/^VIST\[*\]*V*\[1\]/') ,StudyEventKey);
x2 = prxmatch(prxparse('/^VIST\[*\]*V*\[2\]/') ,StudyEventKey);
y = prxmatch(prxparse('/^VIST\[*\]*V*/') ,StudyEventKey);
z = prxmatch(prxparse('/^VIST\[*\]\/*V*\[*\]/') ,StudyEventKey); /*Does not work*/
cards;
VIST[1]/FV[1]
VIST[1]/SV[1]
VIST[1]/TV[1]
VIST[2]/FV[1]
VIST[2]/SV[1]
VIST[2]/TV[1]
;
run;
Hey @Satish_Parida
The First Statement doesn't work because you are looking for the word VISIT then for 0 to n occurences of [ that is probabely not the intended effect.
Something like ^VIST\[\d\]*V*\[*\] would to the trick here.
I highly recommend using https://regexr.com/38ed7 to built your regex.
Kind regards
Criptic
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.