BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 16 replies
  • 639 views
  • 8 likes
  • 6 in conversation