BookmarkSubscribeRSS Feed
Robert_Bardos
Fluorite | Level 6
8-( [sheer nonsense removed ... testing under DMS has its quirks ... should have been more careful, sorry]


Message was edited by: Robert.Bardos
FloydNevseta
Pyrite | Level 9
Change your "and" to "or", and it will work as expected.

> %if %scan(&months,&month) ^= mar and &year^=1997 %then %do;

Since both your conditions are negations, the only way for the expression to evaluate to false for Mar 1997 and execute the else is when the 2 conditions are OR'ed. Thus, the expression is always true when the month is not Mar or the year is not 1997.

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
  • 3674 views
  • 0 likes
  • 8 in conversation