05-31-2013 10:58 AM
I'm trying to set a variable reading from a dataset some clumns value that should contains strange char as a single quote (') or &.
aaa = "aaa'aaa";
bbb = 'bbb';
ccc = "ccc'ccc'ccc";
ddd = 'dd&dd';
proc sql noprint;
select aaa, bbb, ccc, ddd into :vara, :varb, :varc, :vard from inputds;
If I run
Sas does not work. Do there is a way to populate some variables in a safety way independently by what is is contains?
05-31-2013 11:16 AM
You can always get tricky characters into macro variables,. As you have found out, utilizing them later may be difficult.
Just to display them, you can use:
In general, macro quoting functions such as %SUPERQ can temporarily mask the tricky characters. Depending on how you want to use these values, you might need different quoting functions at various points within your code.