我有以下数据,我试图用正则表达式识别“-0.00”值,但这似乎不起作用,请告诉我原因并提供一个可行的解决方案
data master;
input val$ ;
match = prxmatch('m/^\-\d[0]\.\d[0]+/o', strip(val));
datalines;
-0.00
-0.05
0.00
;
run;
这里我使用下面的正则表达式
\- to detect -
\d[0] detect digit which is 0
\. detect a dot
\d[0]+ detect digit which is 0 and happens to be more than once
我尝试使用下面的方法,它有效,但我不想使用这种方法
match = prxmatch('m/^-0.00/o', strip(val));
\d
检测任何数字0
将检测到 0[0]
也会检测到 0\d[0]
您要求检测后面跟着 0 的任何数字在 SAS,您可能会得到更好的服务
val_n = INPUT(val,??best.)