Dear all,
I was wondering whether it is possible to copy labels of encoded variables. Suppose I have the following code:
// Notice: A was a string categorical variable and now it is encoded into a numeric one.
enocode A, gen(enc_A)
// Notice: B was a string categorical variable, with the same categories as A, but now encoded into a numeric one.
encode B, gen(enc_B)
For the sake of example, let's assume they have 3 categories, High, Mid and Low, I would like to have the same numbers assigned to A as to B (i.e. if in A the label is: 1 - High, 2 - Mid, 3 - Low; I would like to have B encoded as 1 - High, 2 - Mid, 3 - Low). Note: I know I can do this by hand, however the problem is that there are about 50+ categories, so I prefer a different approach.
Thanks for your response!
I was wondering whether it is possible to copy labels of encoded variables. Suppose I have the following code:
// Notice: A was a string categorical variable and now it is encoded into a numeric one.
enocode A, gen(enc_A)
// Notice: B was a string categorical variable, with the same categories as A, but now encoded into a numeric one.
encode B, gen(enc_B)
For the sake of example, let's assume they have 3 categories, High, Mid and Low, I would like to have the same numbers assigned to A as to B (i.e. if in A the label is: 1 - High, 2 - Mid, 3 - Low; I would like to have B encoded as 1 - High, 2 - Mid, 3 - Low). Note: I know I can do this by hand, however the problem is that there are about 50+ categories, so I prefer a different approach.
Thanks for your response!
Comment