BookmarkSubscribeRSS Feed
R_A_G_
Calcite | Level 5

Hello,

Could some explain to me what is the difference between single and double ampersand.

thanks

8 REPLIES 8
JerryLeBreton
Pyrite | Level 9
Tom
Super User Tom
Super User

Multiple && will let the macro processor know that it needs to rescan the token to fully evaluate the macro variable reference. This will allow you to use a macro variable to hold the ame of the variable that you actually what.

%Let name=var1;

%let var1=45;

%let n=1;

%put &&var&n;

%put &&&name;

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

&& and & resolve the same value,right?

Amir
PROC Star

Hi,

A double ampersand resolves to a single ampersand. Try using:

options symbolgen;

before @Tom's macro code to see messages in the log explaining what is being resolved.

Regards,

Amir.

Tom
Super User Tom
Super User

Right, and also trigger the compiler to re-evaluate the result.

So &&var&n --> &var1 --> 45

R_A_G_
Calcite | Level 5

how about &&&name ?

what would this resolves into?

Reeza
Super User

45

sassharp
Calcite | Level 5

That is Forward Re-scan rule. If you have SAS advanced Certification Book they explained in Chapter 10.

http://www.caliberdt.com/tips/May2006.htm

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 8 replies
  • 1314 views
  • 0 likes
  • 7 in conversation