Hi,
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.
Thanks
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.
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….
Hi rakeshvvv,
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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.