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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 949 views
  • 0 likes
  • 2 in conversation