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?
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.
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.
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.
Ready to level-up your skills? Choose your own adventure.