Dear all,
I have been struggling with removing spaces from a string variable called booth_id. Here is how it looks:
I have tried removing spaces, tabs in all the possible ways I could think of but nothing works and 0 real changes are made.
When I try to destring after splitting booth_id by "-", it says non-numeric characters however when I do charlist for the second part of the string (following "-"), it returns the following:
0123456789
I don't understand how to remove these spaces from booth_id if they are indeed spaces. I would be grateful if somebody could help me with this.
I have been struggling with removing spaces from a string variable called booth_id. Here is how it looks:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str62 booth_id "98-4 " "98-5 " "98-6 " "98-7 " "98-8 " "98-9" "98-10 " "98-11 " "98-12 " end
Code:
replace booth_id=itrim(booth_id) replace booth_id=ltrim(booth_id) replace booth_id= subinstr(booth_id, char(9), "",.) replace booth_id= subinstr(booth_id, " ", "",.)
0123456789
I don't understand how to remove these spaces from booth_id if they are indeed spaces. I would be grateful if somebody could help me with this.
Comment