![]() 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. 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. 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). 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. which is read as age greater than or equal to 8 and sex equal to 1 and fev not. ![]() This is because they contain NA values, which Stata does not recognize as. The if command (see below) requires that you be able to write logical. ![]() Replace exch_contact_no_temp = 2 if exch_contact_no = "they both didn’t ask for each other's contacts"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"). Stata shows if you have a log file open in status bar. data k a string if a ne another string then put a not equal to 'another string' with ne if a another string then put a not equal to 'another string' with if a another string then put a not equal to 'another string' with run / Output: / a not equal to. Replace exch_contact_no_temp = 1 if exch_contact_no = "they didn't ask about it" Below are some examples of how you can use SAS to check if a variable is not equal to another in a data step.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |