Sas 从包含引号、双引号和不匹配引号的宏变量创建数据集变量

Sas 从包含引号、双引号和不匹配引号的宏变量创建数据集变量,sas,sas-macro,Sas,Sas Macro,总之,我正在努力实现以下目标: data _null_; input x $ 1-50 ; call symput('problem',x); cards4; 'this' "is '' my "string"" from 'hell! ;;;; run; data _null_; x="%superQ(problem)"; put x=; run; superq函数在管理不匹配的引号方面做得很好,但是连续引号(“”)仍然解析回变量X中的单引号 这是可寻址的吗 当前结果: x='this'

总之,我正在努力实现以下目标:

data _null_;
input x  $ 1-50 ;
call symput('problem',x);
cards4;
'this' "is '' my "string"" from 'hell!
;;;;
run;

data _null_;
x="%superQ(problem)";
put x=;
run;
superq函数在管理不匹配的引号方面做得很好,但是连续引号(“”)仍然解析回变量X中的单引号

这是可寻址的吗

当前结果:

x='this' "is '' my "string" from 'hell!
预期结果:

x='this' "is '' my "string"" from 'hell!

简而言之,您可以在此处使用SYMGET:

data _null_;
x=symget("problem");
put x=;
run;
如果出于某种原因这不是一个选项,请提供有关上下文的更多信息。我也会看看我是否能指出托比(SAS-L宏引用大师)或其他一些人在这里,看看他们是否有任何建议来处理这个没有SYMGET

FriedEgg(Matt)在SAS-L发布了以下附加解决方案:

resolve=resolve('%superq(problem)');
他还指出,如果你能控制它,你可以在进来的路上掩盖它:

data _null_;
input x  $ 1-50 ;
call symput('problem',quote(x));
cards4;
'this' "is '' my "string"" from 'hell!
;;;;
run;

data _null_;
  x=&problem;
  put x=;
run;