10-12-2016 05:36 AM
System only accepts a certain length of string. So if the script only allows up to 10 letters including space and the variable name is
"HOLY COW (JIM)"
The output of variable is "HOLY COW (" So when putting the variable in macro, it will write
%let variable=%NRBQUOTE(HOLY COW();
and that give's me an error. the %str won't help because we don't want to put percent signs/symbols (%) before the special character.
thanks in advance.
10-12-2016 06:17 AM
Why are you putting string with special characters in a macro variable to start with. It is a recipe for, if not total disaster, then at least very complicated messy programming. I suspect you want % so that you can use that in like statements. If so, there is rarely any need to put "data" in macro variables, just use the subquery functionality of SQL and put your "data" in datasets. You can then use all the functionality of the SAS language, and subquery that using SQL.
10-12-2016 06:47 AM - edited 10-12-2016 06:49 AM
As @RW9 writes:
If you end up with variable names which don't comply with the SAS naming standards then re-visit your design.
If you want some support with your design then please share more information (what you have to start with and what you need, and code you've already developed ideally also with a data step creating sample data and an explanation how the desired end result should look like).