Sas 未作为字符串读取的字段

Sas 未作为字符串读取的字段,sas,Sas,已解决。见脚注。 /*check regex*/ go = 1; i = 1; do while (go = 1); set braw.regex point = i; if (upcase(fname) = upcase("&var.")) then do; put

已解决。见脚注。

            /*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(&regex.);
    truefalse = prxmatch(pattern, &string); 
    put &regex " " &string " " &truefalse "post";
%mend;
很抱歉,没有缩进-堆栈流似乎有问题或其他什么

这个输出

 /\d{8}/ one
good bye world one
显然,格式不是字符串。因此,在寻找字符串输入时,它会使prxparse失败。 你知道我在做什么吗

我在想我可以使用一个宏变量在它周围加引号,也许可以使用:

call symput('mymacrovar', format1);
%let mymacrovar = "&mymacrovar"; 
但那个辛普特什么也没做

已解决: 它被读取为一个字符串。在从中读取regex数据集的CSV文件上,逗号之间有额外的空格,使得字符串“/\d{8}/”是prxparse不喜欢的

它被读取为字符串。在从中读取regex数据集的CSV文件上,逗号之间有额外的空格,使得字符串“/\d{8}/”(下划线表示空格)是prxparse不喜欢的

您可以(也应该)将您的解决方案作为解决方案放入并将其标记为正确:)并使用而不是
对格式进行排序。