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; 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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