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.

 

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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