SAS author's tip: Using informats to filter invalid values

2

This week's SAS tip is from Ron Cody and his book Cody's Data Cleaning Techniques Using SAS, Second Edition. Ron is the popular author of several bestselling SAS books and has been a SAS user since 1977. Visit Ron's author page for lots of bonus content, including a free chapter from his latest book Cody's Collection of Popular SAS Programming Tasks and How to Tackle Them.

The following excerpt is from SAS Press author Ron Cody and his book "Cody's Data Cleaning Techniques Using SAS, Second Edition" Copyright © 2008, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software) 

Using Informats to Filter Invalid Values

If you want a quick and easy way to test for numeric values in a certain range and simply want to set any other value to missing, you can use a user-defined informat.

PROC FORMAT is used to create three informats (note the use of INVALUE statements instead of the usual VALUE statements). For the informat HR_CK, any numeric value in the range 40 to 100 is unchanged (the keyword _same_ accomplishes this). Any other value is set to missing.

Share

About Author

Shelly Goodin

Social Media Specialist, SAS Publications

Shelly Goodin is SAS Publications' social media marketer and the editor of "SAS Publishing News". She’s worked in the publishing industry for over thirteen years, including seven years at SAS, and enjoys creating opportunities for fans of SAS and JMP software to get to know SAS Publications' many offerings and authors.

Related Posts

Back to Top