BookmarkSubscribeRSS Feed
buechler66
Barite | Level 11

I have the following Case statements:

 

					CASE 
						WHEN %scan(&rule_list, 1,#) AND a.RULEFLAG = "-" THEN "&RULE_ORDER"
						WHEN %scan(&rule_list, 2,#) AND a.RULEFLAG = "-" THEN "&RULE_ORDER"
					END as RuleFlag

The resolution of %scan(&rule_list,1,#) may look like this:  

 

A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL

 

My problem is that I need it to resolve with parentheses around the value.  Like this:

 

(A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL)

 

Any help would be greatly appreciated.

1 REPLY 1
ballardw
Super User

I think you need to have quotes around the # in the scan.

 

Have you tried:

when (%scan(&rule_list, 1,"#"))

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
  • 1 reply
  • 963 views
  • 0 likes
  • 2 in conversation