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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 16 replies
  • 1517 views
  • 0 likes
  • 8 in conversation