在sas宏文件管道中使用引号 [英] using quotes in sas macro filename pipe

查看:818
本文介绍了在sas宏文件管道中使用引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下使用文件名管道的宏。但是得到一个错误,表示无效的选项名称dir等。我怀疑这可能是由于在定义文件名和管道时的引号。我想它认为它是一个选择。我试图删除引号,删除%bquote和只有双引号,但仍然不断得到错误。



我正在使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆