converting string to numerals

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

converting string to numerals

ramesh
This post has NOT been accepted by the mailing list yet.
Hello statalist,
I have a very basic question about coding string variables. My variable is expressed as strongly disagree, disagree, neither disagree nor agree, agree, and strongly agree. I want to code them -2 if strongly disagree, -1 if disagree, 0 if neither disagree nor agree, 1 if agree, and 2 if strongly agree. I used encode(var), gen(var1), but it coded the scales randomly. Is there any direct way to preserve the order in data coding?

Thanks,
Ramesh