Alex
Alex

Reputation: 347

Don't resolve to macrovariable text returned by %substr() with & at the begining

I'm trying to quote a substring of a macro variable. The code is:

%let hola=resuelto!;

%macro prueba(param);
    %let amper=&param;
    %let amper2=%nrbquote(%substr(&param,1,3));
    %put &param;
    %put &amper;
    %put &amper2;
%mend;

%prueba(%nrstr(&hola));

In the log, I'm getting:

WARNING: Apparent symbolic reference HO not resolved.
&hola
&hola
&ho

The problem is I need to assign amper2 literally the value &ho, without any attempt of resolution, like I do with amper, that gets literally the string &hola... any idea?

Thank you in advance!

Upvotes: 2

Views: 53

Answers (1)

fl0r3k
fl0r3k

Reputation: 629

Changing

%nrbquote(%substr(&param,1,3))

to

%qsubstr(&param,1,3)

should do the trick.

Upvotes: 2

Related Questions