I will explain my problem with a simple example: suppose a variable called "var" with the following data: yes, no, may be. Each one as string. I need to do something like this:
foreach i of 0/2{
label define lbl 'i' var['i']
}
(I know there a syntax err, but it's just an example)
The thing is that I want to assign to each numeric value of the label a data from de string variable var and has to start from 0 (already tried with encode command, but haven't been able to change de numeric values using a function like foreach, for, etc). I need to do this because I have a lot of different data inside a variable and can't do it one by one and refuse to believe that I can't do it with stata instead of a text editor. I would really appreciate your help. Thanks!