BookmarkSubscribeRSS Feed
kbhagat
Fluorite | Level 6

Good Morning Everyone,

 

I have driver's license numbers from various states such as Maryland, Virginia, DC, Delaware, or other surrounding states on the East Coast, and so on. This specific variable is currently miscoded, with some license numbers represented as None, XXXXXX, XXXXXXXXXXXX, PPPPPPPPPPPP, FFFFFFFFFFFF, Unknown, or Not available. My objective is to transform these miscoded license numbers into the appropriate blank field. Could someone please provide the most effective method for cleaning this variable?

1 REPLY 1
ballardw
Super User

Are you going to read multiple files with this problem? If so then the most efficient might be a custom informat that will "read" known problems as a blank.

 

If this is a one time thing then something like:

data want;
   set have;
   if license in ( 'None' 'XXXXXX' 'XXXXXXXXXXXX' 'PPPPPPPPPPPP'  'FFFFFFFFFFFF'  'Unknown' 'Not available') then call missing(license);
run;

call missing is a special function that will set any list of variables to the appropriate missing type value.

 

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
  • 611 views
  • 0 likes
  • 2 in conversation