Occasionally, carriage returns and other type blank space values get into the data fields. Sometimes, it is not easy to spot them in the data. However, there is an interesting function in SAS called ANYSPACE which can be used to detect such characters.

The documentation incorrectly states that ANYSPACE returns a 0 when a blank is not detected. To return a 0 when no space is found, you must search from the right. This is done by using a negative value as the second argument.