DATA Step, Macro, Functions and more

How to resove or remove bouble quotes from string macro

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 85
Accepted Solution

How to resove or remove bouble quotes from string macro

I am generating a macro with double quotes in if

eg

%let TEXT=Total outstanding balance for "Rise company" is 25;

Proc print data=sashelp.cars;

title "for period the &text";

run;

i will get error

how to replace or remove this double quotes form text macro

is there any way


Accepted Solutions
Solution
‎04-01-2013 06:07 AM
Respected Advisor
Posts: 3,777

Re: How to resove or remove bouble quotes from string macro

title %sysfunc(quote(for period the &text));

View solution in original post


All Replies
Solution
‎04-01-2013 06:07 AM
Respected Advisor
Posts: 3,777

Re: How to resove or remove bouble quotes from string macro

title %sysfunc(quote(for period the &text));

Frequent Contributor
Posts: 85

Re: How to resove or remove bouble quotes from string macro

i  have one problem

i am connecting to oracle and executing procedure and i am getting error

%put &syserrortext;

 

ORACE execute error: ORA-06550: line 1, column 7Smiley TongueLS-00201: identifier 'PROC_CPR033_VALIDATE11' must be

       declaredORA-06550: line 1, column 7Smiley TongueL/SQL: Statement ignoredORA-06512: at "DEVELOPER.CPR_RETURNS_BACK_DATE", line

       67ORA-06512: at line 1

now i want to display this syserrortext in table or in macro or export as txt

if i use this in title i am getting following error

ERROR: The function QUOTE referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments.

is there any way

Respected Advisor
Posts: 3,777

Re: How to resove or remove bouble quotes from string macro

The commas in syserrortext are the problem.  Try this

%sysfunc(quote(%superq(syserrortext)))

notice there is NO & used with %superq.

Frequent Contributor
Posts: 85

Re: How to resove or remove bouble quotes from string macro

%put &syserrortext;

 

ORACE execute error: ORA-06550: line 1, column 7Smiley TongueLS-00201: identifier 'PROC_CPR033_VALIDATE11' must be

       declaredORA-06550: line 1, column 7Smiley TongueL/SQL: Statement ignoredORA-06512: at "DEVELOPER.CPR_RETURNS_BACK_DATE", line

       67ORA-06512: at line 1

this double quotes is creating a problem

is there any way to remove double or single quotes from macro syserrortext

Super User
Super User
Posts: 6,502

Re: How to resove or remove bouble quotes from string macro

Did you try what data _null_ suggested?

Why do you want to remove the quotes if your intent is to use the value?

To use as a value in a DATA step then use SYMGET and you do not need to worry about the commas or quotes.

data want;

  length syserrortext $400;

  syserrortext=symget('syserrortext');

run;

To use the value in a TITLE statement then use the QUOTE() function.


title %sysfunc(quote(%superq(syserrortext));

Frequent Contributor
Posts: 85

Re: How to resove or remove bouble quotes from string macro

Thanks tom its correct

Frequent Contributor
Posts: 85

Re: How to resove or remove bouble quotes from string macro

data want;

  length syserrortext $400;

  syserrortext=symget('syserrortext');

run;

using this code i am able to handle error in want table

if there is no error i am getting blank data but when i am taking count of syserrortext then i am getting count as 1

how to get 0 if no data is available

🔒 This topic is solved and locked.

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

Discussion stats
  • 7 replies
  • 432 views
  • 1 like
  • 3 in conversation