DATA Step, Macro, Functions and more

How to remove double quote in a macro variable

Accepted Solution Solved
Reply
Contributor
Posts: 32
Accepted Solution

How to remove double quote in a macro variable

 

Hi,

 

I have the following issue in Macro code.

 

%let name = "sam'path";

 

Here I need to remove double quote and need to store the value sam'path in a new macro variable.

 

I tried many options and it is not wokring.

 

Please suggest a solution for this .

 

Thanks,

Sampath

 

 


Accepted Solutions
Solution
‎12-28-2016 01:45 PM
Regular Contributor
Posts: 213

Re: How to remove double quote in a macro variable

If previous tip did not work, try this
%let name = "sam'path";
%let name_unquoted = %qsysfunc(compress(&name,%str(%")));
%put name_unquoted =%superq(name_unquoted);

View solution in original post


All Replies
Regular Contributor
Posts: 213

Re: How to remove double quote in a macro variable

Use %unquote(&name);
Solution
‎12-28-2016 01:45 PM
Regular Contributor
Posts: 213

Re: How to remove double quote in a macro variable

If previous tip did not work, try this
%let name = "sam'path";
%let name_unquoted = %qsysfunc(compress(&name,%str(%")));
%put name_unquoted =%superq(name_unquoted);
Contributor
Posts: 32

Re: How to remove double quote in a macro variable

Big Thanks for the solution.!!! Your 2nd solution fixed the issue.

 

 

 

 

Super User
Posts: 9,682

Re: How to remove double quote in a macro variable

%let name = "sam'path";
%let name_unquoted = %qsysfunc(dequote(&name));

%put &name_unquoted;
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 797 views
  • 1 like
  • 3 in conversation