filename fn "C:/Documents and Settings/yxg/My Documentsmeeting/*.SAS";
data t(keep =str name);
length sd $255. ;
length name $255.;
infile fn filename=sd ;
*注意这里的赋值
name=sd;
name=substr(compress(name),length(compress(name))-10);
input str $255. @@;
re = prxparse("/a1/");
re2 = prxparse("/a2/");
re3 = prxparse("/a3/");
dofind = 0; /*用于查找多个源*/
if prxmatch(re, str) then do;
output;
end;
if prxmatch(re2, str) then do;
output;
end;
if prxmatch(re3, str) then do;
output;
end;
run; 

本文介绍了一个使用SAS编程语言进行文件读取、数据处理及正则表达式匹配的例子。通过设置文件路径并定义数据集结构,实现从指定目录下的文件中读取数据,并利用正则表达式来匹配特定模式的字符串。
dofind

被折叠的 条评论
为什么被折叠?



