sas MACRO ampersand

With a single set of ampersands, what you get is pretty boring; after one, odd number of ampersands leads to resolving twice, even number of ampersands resolves once. So you use 1 ampersand to resolve once and 3 ampersands to resolve twice, unless you have stock in the company that owns rights to the ampersand. … Read more

Dynamically call macro from sas data step

This in part depends on what your macro is doing. If we assume that your macro is doing something that is intended to be run outside of a data step (ie, it’s not just assigning a data step variable), then you have several options. CALL EXECUTE PROC SQL: SELECT INTO macro variable Write macro calls … Read more

Why won’t my macro variable resolve?

Macro variables in SAS won’t resolve when they are in single quotes, ‘&myvar’. They need to be in double quotes, “&myvar”, in order to resolve properly. If you need to have single quotes and a resolved macro variable, you have a few options, but the simplest is: %str(%’&myvar.%’) The %’ inside of %str will place … Read more