I have an annoying problem with my latest piece of research, which is an empirical study (please don't stop reading - I'm getting to the programming part
).
I have a main dataset which attaches a postcode (like zip code) district to each individual. I then have other datasets which I will map into the main one. Unfortunately many of the postcodes (which are saved as strings) in the main set have spaces at the start, and since [(space)B1] is not equal to B1 I can't merge my sets.
Now I have converted the string to an ascii file, and of course I can remove the spaces and reconvert back into my econometric package. But there are about 100,000 offending spaces (stop laughing, it's not funny!). Glancing at the rest of the data it seems there will be further space related problems.
Attached is a .txt file, with a small sample of the observations on individual lines between quote marks. Essentially I need an automated way to remove all spaces within each set of quote marks, so that "(space)(space)B1" becomes "B1"
It's such a trivial problem I'm sure a programmer can suggest a solution straight away. I hope so anyway.

I have a main dataset which attaches a postcode (like zip code) district to each individual. I then have other datasets which I will map into the main one. Unfortunately many of the postcodes (which are saved as strings) in the main set have spaces at the start, and since [(space)B1] is not equal to B1 I can't merge my sets.
Now I have converted the string to an ascii file, and of course I can remove the spaces and reconvert back into my econometric package. But there are about 100,000 offending spaces (stop laughing, it's not funny!). Glancing at the rest of the data it seems there will be further space related problems.
Attached is a .txt file, with a small sample of the observations on individual lines between quote marks. Essentially I need an automated way to remove all spaces within each set of quote marks, so that "(space)(space)B1" becomes "B1"
It's such a trivial problem I'm sure a programmer can suggest a solution straight away. I hope so anyway.

Comment