Solved. See footnote.
/*check regex*/
go = 1;
i = 1;
do while (go = 1);
set braw.regex point = i;
if (upcase(fname) = upcase("&var.")) then do;
put format1 " one"; /*format1 is a field of braw.regex, properties says character length 30*/
if format1 = '/\d{8}/' then put 'hello world one'; else put 'good bye world one';
%check1(&data, format1, &var)
end;
else i = i+1;
end;
/*check1 passes regex, string, true false to check_format*/
%macro check_format(regex, string, truefalse);
pattern = prxparse(®ex.);
truefalse = prxmatch(pattern, &string);
put ®ex " " &string " " &truefalse "post";
%mend;
So sorry about the lack of indentation – stackover flow seems to be being buggy or something.
This outputs
/\d{8}/ one
good bye world one
apparently format isn’t a string. So it then fails the prxparse, as it’s looking for a string input.
Any idea of what I do?
I was thinking I could use a macro variable to put quotes around it, perhaps using:
call symput('mymacrovar', format1);
%let mymacrovar = "&mymacrovar";
but that symput does nothing.
Solved:
It was being read as a string. On the CSV file that the regex dataset was being read from, there were additional spaces between the commas, making the string ‘ /\d{8}/’ which prxparse doesn’t like.
It was being read as a string. On the CSV file that the regex dataset was being read from, there were additional spaces between the commas, making the string ‘_/\d{8}/’ (underscore denoting a space) which prxparse doesn’t like.