我试图修改下面的宏来接受一个宏参数作为dir命令的'location'参数.但是由于嵌套引号问题,我无法正确解析它.使用%str(%')不起作用,也不会出于某种原因引用函数.
当文件路径没有空格(例如C:\ temp\withnospace)时,宏将正常工作,因为不需要中间引号.但是我需要这个宏来处理带空格的文件路径(例如'C:\ temp\with space \').
请帮忙!
%macro get_filenames(location)
filename pipedir pipe "dir &location. /b " lrecl=32767;
data filenames;
infile pipedir truncover;
input line $char1000.;
run;
%mend;
%get_filenames(C:\temp\) /* works */
%get_filenames('C:\temp\with space') /* doesnt work */
Run Code Online (Sandbox Code Playgroud)