Help using Base SAS procedures

&&

Reply
Regular Contributor
Posts: 161

&&

Hello,

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

thanks

Frequent Contributor
Posts: 85

Re: &&

Super User
Super User
Posts: 7,035

Re: &&

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;

Super Contributor
Super Contributor
Posts: 444

Re: &&

&& and & resolve the same value,right?

Super Contributor
Posts: 282

Re: &&

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.

Super User
Super User
Posts: 7,035

Re: &&

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

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

Regular Contributor
Posts: 161

Re: &&

how about &&&name ?

what would this resolves into?

Super User
Posts: 19,767

Re: &&

45

Frequent Contributor
Posts: 110

Re: &&

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

Ask a Question
Discussion stats
  • 8 replies
  • 361 views
  • 0 likes
  • 7 in conversation