Hi everyone!
I'm dealing with my own dataset and I wanted to create a variable called "exch_contact_no_temp" and assign numerical values to it based on an existing string variable called "exch_contact_no". The only problem is that some of the strings of "exch_contact_no" contain curvy quotes ( ’ ) which are automatically transformed into normal quotes ( ' ) once I paste the string on the do-file/on the prompt. However, while running the command, Stata does not recognize both as interchangeable. My code is as follows:
But Stata does zero replacements! I'm attaching a (very short) extract of the original dataset containing two observations of "exch_contact_no" that have curvy quotes ("they didn’t ask about it" and "they both didn’t ask for each other's contacts"). I have tried copying and pasting curvy quotes from old Stata 16 dofiles -- in which I can still see the curvy quotes --, but every time I paste them to the prompt of Stata 17 (or to a do-file of Stata 17), they are automatically converted into normal quotes.
Since the data set has an identifying variable, I guess I can maneuver this issue by assigning numerical values to exch_contact_no_temp based on the identifying variable (and not based on the string variable exch_contact_no). Still, this is very annoying and I don't understand why Stata 17 seems not to support curvy quotes in the prompt but still treats curvy and normal quotes differently when inside a string.
In short, my problem is: there is no way of writing a curvy quote in a prompt or in a do-file (even if I copy and paste from an old dofile containing a curvy quote), but when I run a command like "replace if equal", Stata considers the string with the curvy quote as a different from the string with the same characters but bearing the normal quote.
Many thanks!
Pedro
PS: This is what I mean by a "curvy quote":
PS2: This is a "normal quote":
I'm dealing with my own dataset and I wanted to create a variable called "exch_contact_no_temp" and assign numerical values to it based on an existing string variable called "exch_contact_no". The only problem is that some of the strings of "exch_contact_no" contain curvy quotes ( ’ ) which are automatically transformed into normal quotes ( ' ) once I paste the string on the do-file/on the prompt. However, while running the command, Stata does not recognize both as interchangeable. My code is as follows:
Code:
gen exch_contact_no_temp = . replace exch_contact_no_temp = 1 if exch_contact_no == "they didn't ask about it" replace exch_contact_no_temp = 2 if exch_contact_no == "they both didn’t ask for each other's contacts"
Since the data set has an identifying variable, I guess I can maneuver this issue by assigning numerical values to exch_contact_no_temp based on the identifying variable (and not based on the string variable exch_contact_no). Still, this is very annoying and I don't understand why Stata 17 seems not to support curvy quotes in the prompt but still treats curvy and normal quotes differently when inside a string.
In short, my problem is: there is no way of writing a curvy quote in a prompt or in a do-file (even if I copy and paste from an old dofile containing a curvy quote), but when I run a command like "replace if equal", Stata considers the string with the curvy quote as a different from the string with the same characters but bearing the normal quote.
Many thanks!
Pedro
PS: This is what I mean by a "curvy quote":
PS2: This is a "normal quote":
Comment