In summary, I am struggling to achieve the following:
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;
The superq function does a good job of managing the mismatched quotes, however the consecutive quotes ("") were still resolved back to single quotes in variable X.
Is this addressable?
Current result:
x='this' "is '' my "string" from 'hell!
Desired result:
x='this' "is '' my "string"" from 'hell!
The short answer is that you can use SYMGET here:
data _null_;
x=symget("problem");
put x=;
run;
If that is not an option for some reason, provide some more information as to the context. I'll also see if I can point Toby (the SAS-L macro quoting guru) or some of the other folks there here, to see if they have any suggestions for handling this without SYMGET.
From SAS-L, FriedEgg (Matt) posted the following additional solution:
resolve=resolve('%superq(problem)');
He also notes that you can mask it on the way in, if you have control over that:
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;