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

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