I've difficulties in understanding of using single quotes and double quotes in a macro. Also I would like to know usage of single ampersand and double ampersand as well. Ideally I wish to know the occasions where we tend to use double ampersand and single quotes and double quotes in a macro.
If someone can expalin it in simple terms I would be really grateful
Thanks in advance!
These are the most basic features of SAS macro. There are tons of papers, documentation and samples.
If you wish to develop macro programming skill, consider to take some training.
In short, everything between single quotes is unaffected by macro logic - no symbolic substitution will take place.
Between double quotes, substitution can take place.
Double ampersand can be used if you wish to nestle macro variable names in each other - in other words, store dynamically a macro variable name in another macro variable, and then wish to substitute to the original macro variable value.
LinusH has kindly provided an explanation. I would like to add that in my opinion if you are finding you have more than one & or % in a line of code then there is almost always a better way of doing things. Simply restructuring your data, coding differently, or using functions removes the need for all lof it. Remember easy to read code is maintable by other people.
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.
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.