Hi!
I have a very dirty data set I'm trying to clean and I'm a bit stuck. The variable for height "ht" is entered in many different ways both as inches and centimeters, with units listed in different ways.
For example:
156c
157 c
158.2 cm
62i
63.5 in
I'm having trouble figuring out a systematic way to clean this. As I see it I need to a) remove the internal spaces between the numeric values and the unit descriptions so that all values are uniform. Then I need to split the units from the numeric values. Then convert all the values into a standard a standard units i.e. inches --> cm. Aside from knowing how NOT to design data entry for the future, I'm stuck on how to manipulate this data in stata. I tried splitting, but because the spaces between the units are variable (either 0, 1, 2) the split was not useful. I tried permutations of the "itrim" command as listed on various websites, but state didn't recognize it...so a bit stuck. I also tried thinking about coming from the end of the expression using the regexs /regexm commands to list $cm but got nowhere.
Thanks for any guidance!
Juno