12-16-2015 02:33 AM
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!
12-16-2015 02:40 AM
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.
12-16-2015 05:28 AM
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.