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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.