【发布时间】:2019-08-08 16:44:51
【问题描述】:
我有两个宏变量,路径和文件,它们都包含特殊字符。我对两者都使用 %str 。然后将它们组合为另一个宏变量,直接。
当我在文件名管道语句中使用 &direct 时,它没有被解析。
谁能告诉我这是怎么回事?
我尝试过双引号或 %sysfunc(cats())。也不行。
代码为:
%let path=%str(B:\Enrollment Report\Fall 18\18F Enroll- MASTER\);
%let file=%str(18F Enroll as *.xlsx);
%let direct=%sysfunc(cats(&path, &file));
%put &direct;
filename dirlist pipe 'dir "&direct" /b';
NOTE: The infile DIRLIST is:
Unnamed Pipe Access Device,
PROCESS=dir "&direct" /b,RECFM=V,LRECL=200
【问题讨论】:
-
宏触发器 & 和 % 不会在外部使用单引号的字符串内部进行评估。