Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change letters into numeric with corresponding label

    I have a string variable called alphabet and it has observations A B C D E etc. I would like to convert these to 1 2 3 4 5 etc (each number representing the position of the letter in the alphabet) with a value label applied (A B C D E etc) so that I know which number represents which letter. Reason for doing so is because I want to include this variable as a categorical predictor in a model.

    Many thanks in advance

  • #2
    Details are important. Do you really have the letters of the alphabet? What is the position of a letter in the alphabet going to predict?

    Anyway, look at

    Code:
    help encode
    and make sure to read the helpfile carefully before applying the command.

    Comment


    • #3
      Thanks, that works!

      Comment

      Working...
      X