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

Hi all,

       Can any body help me to understand how it will executes                                                             

%let one=two;
%let two=three;
%let three=Check;


%put &one;
%put &&one;
%put &&&one;
%put &&&&one;
%put &&&&&one;
%put &&&&&&one;
%put &&&&&&&one;
%put &&&&&&&&one;
%put &&&&&&&&&one;
%put &&&&&&&&&&one;

what is the differnce between &,&& and &&&

How can i understand this concept.



Thanks &Regards

Rawindarreddy



1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

In addition to Peter's (excellent) suggestion, searching on the forum would reveal this previous forum posting:

https://communities.sas.com/message/12344#12344 that discusses the forward scan rule and the rescan rule of macro variables (which are the topics you should search for in the documentation). In addition, turning on the system option SYMBOLGEN will help you see the trace of macro variable resolution (including how multiple ampersands are resolved) in the SAS Log. Also, there have been some user group papers on how to approach the resolution of multiple ampersands, such as these two -- there are more if you search:

http://www2.sas.com/proceedings/sugi29/063-29.pdf

http://www2.sas.com/proceedings/sugi22/CODERS/PAPER77.PDF

Also, for a beginner's introduction to macro processing in general, I recommend this paper:

http://www2.sas.com/proceedings/sugi28/056-28.pdf

cynthia

View solution in original post

4 REPLIES 4
Peter_C
Rhodochrosite | Level 12

the macro manual is available on-line at http://support.sas.com/documentation

Cynthia_sas
SAS Super FREQ

In addition to Peter's (excellent) suggestion, searching on the forum would reveal this previous forum posting:

https://communities.sas.com/message/12344#12344 that discusses the forward scan rule and the rescan rule of macro variables (which are the topics you should search for in the documentation). In addition, turning on the system option SYMBOLGEN will help you see the trace of macro variable resolution (including how multiple ampersands are resolved) in the SAS Log. Also, there have been some user group papers on how to approach the resolution of multiple ampersands, such as these two -- there are more if you search:

http://www2.sas.com/proceedings/sugi29/063-29.pdf

http://www2.sas.com/proceedings/sugi22/CODERS/PAPER77.PDF

Also, for a beginner's introduction to macro processing in general, I recommend this paper:

http://www2.sas.com/proceedings/sugi28/056-28.pdf

cynthia

rawindar
Calcite | Level 5

thank......u Cynthia.I got it

art297
Opal | Level 21

And, after you've read everything that Peter and Cynthia suggested, try running the following expanded version of your code and see if you can predict what the various resulting values will be:

%let Check=four;

%let one=two;

%let two=three;

%let three=Check;

%let four=five;

%let five=six;

%put &one;

%put &&one;

%put &&&one;

%put &&&&one;

%put &&&&&one;

%put &&&&&&one;

%put &&&&&&&one;

%put &&&&&&&&one;

%put &&&&&&&&&one;

%put &&&&&&&&&&one;

%put &&&&&&&&&&&one;

%put &&&&&&&&&&&&one;

%put &&&&&&&&&&&&&one;

%put &&&&&&&&&&&&&&one;

%put &&&&&&&&&&&&&&&one;

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2096 views
  • 0 likes
  • 4 in conversation