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.
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!
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.