Hello,

I am new to Stata and I am having the same problem as Alyssa Beavers mentioned in her post "Help with strtrim", except the suggested solution does not work in my case. I use Likert variables (imported from Excel) and some values have trailing spaces ("très bien " and "assez bien ") for the example below (the variable type is str27):

list SentBien in 1/10

+-----------------+
| SentBien |
|-----------------|
1. | très bien |
2. | légèrement bien |
3. | très bien |
4. | assez bien |
5. | assez bien |
|-----------------|
6. | assez bien |
7. | légèrement bien |
8. | neutre |
9. | assez mal |
10. | neutre |
+-----------------

I executed the command "replace SentBien = strtrim(SentBien)" without error but I received the message "(0 real changes made)".
It seems that the blank space in the value is not the regular blank space from my keyboard because if I type the command ---- count if SentBien=="très bien " --- it returns 0 but if I copy paste the "très bien " from the screen, then the command returns 108. However, in both cases, there is (what seems to be) one blank space at the end of the string.

Do you have an explanation of this? And a solution to still delete those trailing spaces?

Thank you in advance for your help!