From: Jan Klaverstijn on
Hi all,

I have a weird problem that came up while using DI Studio. DI studio has
the habit of wrapping options of user written transformation in
%NRQUOTE. This is in itself perfectly understandable. But it bytes me in
a peculiar way. The following code is only conceptually equal to what we
have in DI, but it shows the issue.

The following code fails.

%let lib=SASHELP;
%let gen_code=%nrquote(LASS);
%macro runit(gen_code);
proc sql;
select count(*) from &lib..C&gen_code;
quit;
%mend;
%runit(&gen_code);

The error is FILE SASHELP.C.DATA does not exist.
Obviously the reference &gen_code is not resolved, or resolves to nothing.

I have pinpointed the literal prefix C as the culprit. Tish code works
as I expect it to. The literal C is now part of the value and no longer
a literal.

%let lib=SASHELP;
%let gen_code=%nrquote(CLASS);
%macro runit(gen_code);
proc sql;
select count(*) from &lib..&gen_code;
quit;
%mend;
%runit(&gen_code);

If I use %UNQUOTE on the value before calling the macro everything is
OK. This will be my workaround. I can see this happening in 8.2, 9.1.3
and 9.2.

I am missing something here. Considering the abundant use of %NRQUOTE in
our DI studio generated code this knowledge gap makes me very uncomfortable.

Can anybody explain what I see?

Thanks in advance,
Jan Klaverstijn.

Kind regards,
From: data _null_; on
This behavior is common and well documented.

On Jun 21, 6:17 am, Jan Klaverstijn <jklaverst...(a)casema.nl> wrote:
> If I use %UNQUOTE on the value before calling the macro everything is
> OK. This will be my workaround. I can see this happening in 8.2, 9.1.3
> and 9.2.

I would put the UNQUOTE in the macro.

select count(*) from %unquote(&lib..C&gen_code);

From: Jan Klaverstijn on
On 21-06-10 14:28, data _null_; wrote:
> This behavior is common and well documented.
>
> On Jun 21, 6:17 am, Jan Klaverstijn<jklaverst...(a)casema.nl> wrote:
>> If I use %UNQUOTE on the value before calling the macro everything is
>> OK. This will be my workaround. I can see this happening in 8.2, 9.1.3
>> and 9.2.
>
> I would put the UNQUOTE in the macro.
>
> select count(*) from %unquote(&lib..C&gen_code);
>

Thanks. Good to know this is documented and thus expected behaviour. I
will make sure the code will cope.

Could you point me to this documentation? I have searched and did not
find the explanation of my particular case with the literal prefix.

Thanks in advance,
Jan.