05-15-2014 02:53 PM
I am in the process of cleaning my data…For a variable, is there any function or procedure that will find out special characters or symbols or more then one space in a partilcualr variable. I need to find out if there are any special characters in my dataset.
05-15-2014 02:58 PM
Sometimes its easier to check for what you're looking for.
Ie are the variables all character or numeric?
Look into the ANY<type> of functions - ie anyalpha anydigit anycontrol anypunct
Compress is also a useful function with the appropriate modifiers.
05-15-2014 03:02 PM
I am looking into character variable and we don’t know the type of spcl characters present in the variable but we have filter out if there are any spcl characters in that variable….
05-15-2014 03:05 PM
I am aware of many "tricks" to do what you need. You can scan, index, find, translate a variable to find or remove special characters. You can remove all numbers and alphas leaving just special characters. You can compare the length of the original variable to the length of a trimmed, scanned, indexex, found, translated variable. A variable that is the same length before and after functioning it has no special characters.
I am certain that there are many folks who have routines that they regularly use. Is there a special style you are comfortable with? Is there a special set of values you want to check for? If you trim(left( a variable then translate the remaining spaces to ** you can count the number of ** values in a variable. If there are more than one * values, then you know you have a variable with two spaces in the middle of the variable.