BookmarkSubscribeRSS Feed
qadri0345
Calcite | Level 5

Hello 🙂

 

Hoping I can get some help here. I have a variable that has postal codes listed for case ID's. Some are available and some are not. I am trying to re-code my 'Postal Code' variable so that it either has 0 for missing and 1 for available, or I can also change it to "Available" and "Not Available" ...I managed to change the missings to 0 but I can't figure out how to change the many diff postal codes into a single number or word. Any help would be really appreciated!

1 REPLY 1
A_Kh
Barite | Level 11

If you have recoded 'Missing' as 0 you should be able to recode the 'Non-missing' values to 1 eg., with simply IF/THEN, ELSE statement:

data want;
	set have;
	if not missing(PostalCode) then PostalCode=1;
	else PostalCode=0;
run; 

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
  • 553 views
  • 1 like
  • 2 in conversation