BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Hey does anyone know how to resolve &Key to &animal (or animal) and not platypus and not key?

12   %let animal = platypus;

13   %let key = &animal.;

14

15   %put %str(&key.);

platypus

16   %put %nrstr(&key.);

&key.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

%let animal = platypus;

%let key = %nrstr(&animal.);

%put &key;

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

Not sure what you mean.

If you want &KEY to resolve to animal then set it to animal.

%let key=animal ;

If you want include macro trigger in the value then quote the trigger.  Your attempt with %STR(&animal) is quoting the result of the macro variable expansion.

%let key=%str(&)animal ;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

The question from me would be why? 

Ksharp
Super User

%let animal = platypus;

%let key = %nrstr(&animal.);

%put &key;

BenHere
SAS Employee

Ahhh thank you Xia.   This will work for what we need.

Inheriting large complicated programs is not much fun. 

To all, thank you for responding.  

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 772 views
  • 0 likes
  • 4 in conversation