DATA Step, Macro, Functions and more

How to get rid of %nrquote in DI Studio

Reply
Contributor
Posts: 51

How to get rid of %nrquote in DI Studio

Hi,

I'm trying to get rid of %nrquote for an option of a user written tool.

I have set up 2 options and for 1 of them %nrquote should not be used in the gererated code. Setting it to Integer as attribute of the option does not help.

Background:

%let x = %nrquote(7);
[...]
data &_output.;
[...]
input (fln1-fln&_x) ($);
run;
[...]

Attaching &_x nrquoted does not work, with %let x = 7 it works.

Thanks and regards,
Thomas
Respected Advisor
Posts: 4,173

Re: How to get rid of %nrquote in DI Studio

Hi Thomas

Not sure if that will help you:

What I encountered in DI was that options (macrovars) were somehow quoted which caused problems when using the macrovar values in comparisons.
What helped was (in user written code) to %unquote() them.

if myvar=%unquote(&myoptionMvar) then....

HTH
Patrick
Super User
Posts: 5,441

Re: How to get rid of %nrquote in DI Studio

Patrick's tip has helped me as well several times, and it will help in this situation as well, except for...just of curiosity, could it really work with x = 7? x and _x are totally different macro variables...?! Have you defined _x somewhere else in your code perhaps or is it a typo?

Regards,
Linus
Data never sleeps
Contributor
Posts: 51

Re: How to get rid of %nrquote in DI Studio

Hi,

that was a typo indeed, but %unquote helped out anyway!

Thanks a lot,
Thomas
Ask a Question
Discussion stats
  • 3 replies
  • 158 views
  • 0 likes
  • 3 in conversation