I take it as a side effect of SAS's desired to maintain backwards compatibility. Quotes weren't required before, so they still aren't.
The syntax for the LABEL statement is LABEL followed by zero or more NAME = LABEL pairs.
Note that you do need quotes when not having them would change how the statement is interpreted (parsed?).
For example if I had wanted a label with an equal sign in it. For example:
label sex= 'M=Male F=Female' ;
If I remove the quotes
label sex= M=Male F=Female;
and try it the SAS log will show:
NOTE: Variable M is uninitialized.
NOTE: Variable F is uninitialized.
Because now I have three name=label clauses instead of one.
But if the thing before the = is not valid as name
label age=11=low 14=high;
then it works.
Note that where I see this syntax quirk used more often is in PROC FORMAT steps.
proc format fmtlib ;
value $sex M=Male F=Female;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.