Your code looks ok.
If your data is like you say there should be no problem.
I'm expecting to have below result:
Table tmp
Id Code Type
————————
1 A OK
2 A OK
3 B Fail
or at least below result if the code cannot be mapped:
Table tmp
Id Code Type
————————
1 A
2 A
3 B
But I just cannot understand why I can get below result (with Code value became all NULL)
Table tmp
Id Code Type
————————
1
2
3
Provide your data as a DATA Step.
See this post on how to do it:
Since your data is simple, you can write the DATA Step quite easy yourself, see example below
data tmp;
input
Id
Code $
;
cards;
1 A
2 A
3 B
;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.