BookmarkSubscribeRSS Feed
Christien
Calcite | Level 5

I have the next code:

"case when t1.AGB_instelling = '1.06' then Key_spec='03.05'

when t1.AGB_instelling = '1.07' then Key_spec='03.06'

end

For eacht AGB_instelling there are N Key_spec, for the two mentioned AGB_inst. I want the mentioned Key_spec but for other AGB_instellingen I don't care. But in the results I only found the two mentioned AGB_instellingen and no other. How can this be solved?

3 REPLIES 3
Reeza
Super User

Else.

case when t1.AGB_instelling = '1.06' then Key_spec='03.05'

when t1.AGB_instelling = '1.07' then Key_spec='03.06'

else key_spec="dont care"

end

DBailey
Lapis Lazuli | Level 10

reeza always beats me to the answer...

DBailey
Lapis Lazuli | Level 10

you should use the else clause to specify what should happen.

case

     when t1.AGB_instelling = '1.06' then Key_spec='03.05'

     when t1.AGB_instelling = '1.07' then Key_spec='03.06'

     else ????

end

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 460 views
  • 0 likes
  • 3 in conversation