How to read string w/ an open parenthesis using %NRBQUOTE?

Reply
New Contributor
Posts: 2

How to read string w/ an open parenthesis using %NRBQUOTE?

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.

Super User
Posts: 9,681

Re: How to read string w/ an open parenthesis using %NRBQUOTE?

Why not refer to it directly ?

 

 

1 %let variable=HOLY COW(;
2 %put %superq(variable);
HOLY COW(

New Contributor
Posts: 2

Re: How to read string w/ an open parenthesis using %NRBQUOTE?

thank you we will try this. will keep you posted.
Super User
Super User
Posts: 7,401

Re: How to read string w/ an open parenthesis using %NRBQUOTE?

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.

 

Respected Advisor
Posts: 3,892

Re: How to read string w/ an open parenthesis using %NRBQUOTE?

[ Edited ]

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).

Ask a Question
Discussion stats
  • 4 replies
  • 298 views
  • 0 likes
  • 4 in conversation