@JacobH wrote:
Presumably because the macros are not defined for each observation, but for the dataset as a whole?
Hi Jacob,
It's how the SAS macro processor works. SAS code is first handled by that macro processor before the data step runs. By the time the macro processor is has done its job all macro references are removed, either by executing statements (%let ...) or by resolving variable references (¯o_start_...). Be careful to distinguish what happens when. This is a common mistake and I suggest you read up on macro processing in general. The resolution of your actual challenge, creating variable names based on data values, will be much more evident after that.
On a side note I confess that variables that contain data values are my main pet peeve. They tend to make reporting and analysis very hard.
Hope this helps,
-- Jan
... View more