Hello Statalist -
I have a rather simple request, and I believe that there should be a simple solution out there! I am running IC/15.1.
I have a string variable that I would like to encode. It is simple to do the following:
However, I would like "1" to correspond to the most frequent value, "2" to the second-most frequent, etc.
An example; the below is using

If I use
, then "DRC" will have a value of 2, "Drug Crt." will have a value of 3, etc.
I would like "Int. Supv." to have a value of "2", "DRC" to have a value of 3, etc.
Thank you very much!
Spencer
I have a rather simple request, and I believe that there should be a simple solution out there! I am running IC/15.1.
I have a string variable that I would like to encode. It is simple to do the following:
Code:
encode string_var, generate(encoded_var)
An example; the below is using
Code:
tabulate string_var

If I use
Code:
encode
I would like "Int. Supv." to have a value of "2", "DRC" to have a value of 3, etc.
Thank you very much!
Spencer
Comment