Hi everyone, my programmer collaborator and I have been banging our heads on this one, can you help? It's for our medical survey.
I have a variable QID88_7_TEXT
each obs has an id# so I'll use that for clarity
that observation has this id value: 1747
We cannot make any changes in the values of the original data, so we can't replace this value, only create a new dataset based on do files
in the STATA data browser window, the id 1747 value for QID88_7_TEXT is this:
When I run this code:
STATA returns this, indicating it is not finding a == match:
Looking at the string, I try it with a leading space, like this:
STATA returns this, indicating it is not finding a == match:
When I do a partial string match, it finds the obs:
I think the problem is with the special character, in UTF-8 it is this:
Note that it appears multiple times in the string. Here is the string again, copypasted from OSX directly from the STATA browser into Chrome:
So the question is, How do I rewrite the following code so that it will == locate the special character, identify the obs, and do the value replace?
THANK YOU!!!!!
PS
I have tried the code with a leading space and without a leading space. In the STATA data browser a leading space does seem to be in the string in question, but for some reason copy-paste drops the leading space. This might be a red herring but thought I'd mention it!
I have a variable QID88_7_TEXT
each obs has an id# so I'll use that for clarity
that observation has this id value: 1747
We cannot make any changes in the values of the original data, so we can't replace this value, only create a new dataset based on do files
in the STATA data browser window, the id 1747 value for QID88_7_TEXT is this:
Code:
I’ve stopped asking. And they don’t tell me voluntarily. I give so few fox, that I honestly can’t answer this question with confidence. In my mind the most accurate is PTSD, but I’m sure depression and bipolar are on the chart somewhere.
Code:
replace dx_recode = 24 if QID88_7_TEXT == "I’ve stopped asking. And they don’t tell me voluntarily. I give so few fox, that I honestly can’t answer this question with confidence. In my mind the most accurate is PTSD, but I’m sure depression and bipolar are on the chart somewhere."
Code:
(0 real changes made)
Code:
replace dx_recode = 24 if QID88_7_TEXT == " I’ve stopped asking. And they don’t tell me voluntarily. I give so few fox, that I honestly can’t answer this question with confidence. In my mind the most accurate is PTSD, but I’m sure depression and bipolar are on the chart somewhere."
Code:
(0 real changes made)
Code:
list QID88_7_TEXT if strpos(QID88_7_TEXT, "asking") > 0 +-----------------------------------------------------------------------------------------------------------------------+ | QID88_7_TEXT | |-----------------------------------------------------------------------------------------------------------------------| 1138. | I’ve stopped asking. And they don’t tell me voluntarily. I give so few fox, that I honestly can’t answer this ques.. | +-----------------------------------------------------------------------------------------------------------------------+ .
Code:
’ E2 80 99 Right single quotation mark
Code:
I’ve stopped asking. And they don’t tell me voluntarily. I give so few fox, that I honestly can’t answer this question with confidence. In my mind the most accurate is PTSD, but I’m sure depression and bipolar are on the chart somewhere.
Code:
replace dx_recode = 24 if QID88_7_TEXT == " I’ve stopped asking. And they don’t tell me voluntarily. I give so few fox, that I honestly can’t answer this question with confidence. In my mind the most accurate is PTSD, but I’m sure depression and bipolar are on the chart somewhere."
PS
I have tried the code with a leading space and without a leading space. In the STATA data browser a leading space does seem to be in the string in question, but for some reason copy-paste drops the leading space. This might be a red herring but thought I'd mention it!
Comment