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!
Related Posts with Help with strtrim 2
Error r(134) in roccompHi everyone. I am trying to compare the AUCs of two tests, y1 and y2. The outcome variable (true dia…
Looping over if statementsI want to write code that loops over various if conditions in a regression. I have data like this: …
A Problem with Creating Standardized Variables for Each VariableDear all, I am trying to create new variables based on some specific variables ending with "dac2a".…
Comparing proportions using svy commandHello, I am a PhD student and working in stata only since 2 years. I need to compare proportions o…
combine observations under conditionsHi there, I am seeking help to combine rows into one under a certain ID. The conditions are as below…
Subscribe to:
Post Comments (Atom)
0 Response to Help with strtrim 2
Post a Comment