我用一个getfileinfo的宏,读取了一个文件夹下的所有文件列表到SAS的表格
然后想用SQL挑选带有特定后缀文件名的行,用的是如下的代码:
proc sql noprint;
create table FileList as
select *,monotonic() as _N_
from FileList_temp
where scan(FileName,-1,'.')='TXT' or
scan(FileName,-1,'.')='CSV';
quit;
现在有个新任务,就是挑选后缀为YYYYMMDD型日期的文件,比如abc.20111020这样的
如果还是用上面的方法,该怎么写SQL中的Where子句呢
我先试着用了scan(FileName,-1,'.')>10000000 and scan(FileName,-1,'.')<20990000这样简单的方法
只是SAS报错说
ERROR: Expression using greater than (>) has components that are of different data types.
ERROR: Expression using less than (<) has components that are of different data types.
所以想不到其他好的方法了
如果用正则的话,可能就用不到这个SQL过程了,总的程序可能就不那么简洁了
请牛人指教,谢谢!