BookmarkSubscribeRSS Feed
bharathtuppad
Obsidian | Level 7

%put &a &&&b &&&&&&&c;

How this works?

4 REPLIES 4
Ksharp
Super User

Each time for two & .

&a

-> result_of_&a

&& &b

->&(result_of_&b)

&& && && &c

->& &   & (result_of_&c)

->  &   result_of_(& (result_of_&c)

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Seriously, just don't do it.  If your having to use more than one & in code, then I would suggest your programming it wrongly.  Think about the problem and the data differently, will transposing/normalising the data change the code, can you use arrays, or SQL aggregates etc.  Many ways to solve a problem.

Cynthia_sas
Diamond | Level 26

Hi:

  I agree with RW9 that references like &&&&a and &&&&&b are generally unnecessary, there are SOME indirect references to macro variables such as &&macvar&num that are quite useful, especially when you have numbered macro variables. I have an example of this in my paper on Macro Basics: http://support.sas.com/resources/papers/proceedings13/120-2013.pdf see Figure 18 and explanation on pages 10-11.

cynthia

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1883 views
  • 0 likes
  • 5 in conversation