09-09-2016 07:43 AM
I get stuck in an easy peasy situation.
%let abc3=got it;
Now i want &abc3 but using x+1.So iam using below statement:-
But its not working.
Please take me out from this easy peasy situation.
09-09-2016 08:58 AM - edited 09-09-2016 09:01 AM
Why make this hard on yourself?
%let x=2; %let abc3=got it; %let y=%eval(&x+1); %put &&abc&y;
I don't have SAS in front of me, but...
I think when you do &&abc%eval(&x+1), there is a macro quote character between "abc" & "3".
You could try something like:
%put &&abc%unquote(%eval(&x+1)), or perhaps %put %superq(abc%eval(&x+1)) *might* work. But if I were coding this I would do it as above. Other approaches look like line noise or obfuscated Perl.
09-09-2016 09:25 AM
Yes I think &&abc%eval(&x+1) yields &&abc<a non-printable macro quoting character>3.
And &abc is not defined...&abc3 is.
Just do your %eval() first, then use those results as your macro variable suffix.