dxystata 发表于 2014-1-23 22:40 
如果是long_string1.txt,如何把abc替换为long_string1.txt的内容呢?谢谢!
options noquotelenmax;
data _null_;
file "c:\temp.txt" ;
infile "c:\longstring.txt" truncover firstobs=1 end=last1;
length temp$11000.;
retain temp;
do until (last1);
input x $11000.;
temp=cats(temp,_infile_);
if last1 then call symput("string",temp);
end;
infile "c:\123.txt" truncover firstobs=1 end=last2;
length _xyz $11000.;
do until (last2);
input xyz $11000.;
if index(_infile_,'abc')^=0 then do;
if findc(_infile_,'x','b')>3 then _xyz=cats(scan(_infile_,1,'abc'),resolve('&string'),scan(_infile_,-1,'abc'));
else _xyz=cats(scan(_infile_,1,'abc'),resolve('&string'));
end;
else _xyz=xyz;
put _xyz $;
end;
run;