【发布时间】:2019-01-24 02:40:46
【问题描述】:
我正在使用以下 SAS 代码查找目录 &directory. 下的所有文件及其大小
filename tmp pipe "find &directory. -type f -printf '%p %s\n'";
data all_files;
infile tmp;
length file_path $255. size 8.;
input file_path size;
run;
虽然输出数据tmp是我想要的,但代码会给我警告。
警告:对宏 S 的明显调用未解决。
我尝试在“%”之前添加一个额外的“%”,即
filename tmp pipe "find &directory. -type f -printf '%%p %%s\n'"
但它不起作用。
我怎样才能摆脱警告?谢谢。
我也试过%str和%nrstr,
filename tmp pipe %str("find &directory. -type f -printf '%p %s\n'");
filename tmp pipe %nrstr("find &directory. -type f -printf '%p %s\n'");
filename tmp pipe %str("find &directory. -type f -printf '%%p %%s\n'");
filename tmp pipe %nrstr("find &directory. -type f -printf '%%p %%s\n'");
filename tmp pipe "find &directory. -type f -printf '%str(%%)p %str(%%)s\n'");
filename tmp pipe "find &directory. -type f -printf '%nrstr(%%)p %nrstr(%%)s\n'");
他们都没有解决问题。
【问题讨论】:
-
你试过用
%str()或%nrstr()包装它吗? support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/… -
或
%str(%%)p %str(%%s) -
@Reeza 试过了,但它们要么不工作,要么给出同样的警告。