在sas宏文件管道中使用引号 [英] using quotes in sas macro filename pipe
问题描述
我正在使用Windows,但也会在Linux上远程运行。任何想法都将深受赞赏。
%macro setprogvar(dateval);
%全局日期;
%let date =& dateval;
%put& date;
%put& dateval;
%let filepath =%bquote(C:\Research\SASDataSets\bulk all data& date);
filename CDR_Bulk管道dir& filepath / a:-d-h-s / b / s;
%mend setprogvar;
%setprogvar(20100331);
*** LOG ************
1 filename CDR_Bulk pipedir& filepath / a:-d-h-s / b / s;
---
23
错误23-2:无效的选项名称dir。
1! filename CDR_Bulk pipedir& filepath / a:-d-h-s / b / s;
-
23
错误23-2:选项名称无效a。
文件路径宏变量需要以双引号括起来它包含空格。但是当您的字符串被双引号时,您需要双引号...
filename CDR_Bulk pipedir&filepath / a:-dhs / b / s;
I am using the following Macro that uses filename pipe. But get an error saying invalid option name "dir", etc. I suspect it could be due to the quotes while defining filename and pipe. I guess it recognizes it as an option. I tried to remove the quote, removing %bquote and having just the double quote, but still keep getting the errors.
I am using Windows, but will also be running it remotely on Linux. Any thoughts would be deeply appreciated.
%macro setprogvar(dateval);
%global date;
%let date=&dateval;
%put &date;
%put &dateval;
%let filepath = %bquote("C:\Research\SASDataSets\bulk all data &date");
filename CDR_Bulk pipe "dir &filepath /a:-d-h-s /b /s";
%mend setprogvar;
%setprogvar(20100331);
***LOG************
1 filename CDR_Bulk pipe "dir &filepath /a:-d-h-s /b /s";
---
23
ERROR 23-2: Invalid option name dir.
1 ! filename CDR_Bulk pipe "dir &filepath /a:-d-h-s /b /s";
-
23
ERROR 23-2: Invalid option name a.
The filepath Macro variable needs wrapping in double-quotes as it contains spaces. But as your string is double-quoted, you need double-double-quotes...
filename CDR_Bulk pipe "dir ""&filepath"" /a:-d-h-s /b /s";
这篇关于在sas宏文件管道中使用引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!