我想獲取傳遞給宏變量的值,並在其周圍加上引號。即空格分隔的列表到空格分隔的引用列表。例如下面給出。我在以前的一篇文章中使用了Jeff給出的以下方法。文字包含無與倫比的報價。 (SAS)
data test;
id =1; _var="ABC"; output;
id =1; _var="DEF"; output;
id =1; _var="UVW"; output;
id =2; _var="UVW"; output;
id =3; _var="ABC"; output;
id =3; _var="UVW"; output;
id =3; _var="XYZ"; output;
id =4; _var="ABC"; output;
id =4; _var="XYZ"; output;
run;
%macro __test1(_byvar=, _qnam=, _id=);
proc sort data= test out=_test;
by &_byvar.;
%if %superq(_qnam) ne %then
%do;
%let __tmpmv_qnam = %qsysfunc(prxchange(%bquote(s/\b/"/),-1,%bquote(&_qnam)));
*";
%put ^^^^^&__tmpmv_qnam.;
where upcase(&_id) in (&__tmpmv_qnam);
%end;
run;
%mend;
%__test1 (_byvar=id ,_qnam = ABC UVW, _id=_var);
日誌diaplayed以下錯誤:
SYMBOLGEN: Macro variable _QNAM resolves to ABC UVW
ERROR: Literal contains unmatched quote.
請在這一個幫助。