Hi, I have a string variable, vq9_breakupdivorce, which has only 2 string values.
I want to encode it to 0 and 1. And 0 denotes NO TO: and 1 denotes otherwise. How to use substr? Because I have multiple such variables, and all of them are in this form (NO TO: = 0).
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str23 vq9_breakupdivorce "NO TO: Break up/divorce" "NO TO: Break up/divorce" "Break up/divorce" "Break up/divorce" "NO TO: Break up/divorce" end
Comment