Announcement

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

  • Convert multiple variables from str to int respecting regularities

    Dear all,
    I have a dataset of two string variables: Input_address and Output_address. I need to convert them from string to int to save memory (about 100million rows).
    The point is that some Input_address and output_address are the same, and I want them to remain the same also after encode the variables.
    I mean, if Input_address (first column) is "hanb23bd4.."*, and in Output_address I have the same "hanb23bd4.."*, I want them to be converted into the same number once run encode.
    I don't know how to do that.
    Thank you in advance,
    Marco
    *fictitious example

  • #2
    Look up the help file for the destring command

    Comment


    • #3
      I don't think destring applies here at all. The issue is to get encode producing consistent results. See multencode from SSC. I would apply trim(itrim()) first to each string variable to avoid spurious differences.

      Comment


      • #4
        Great! multencode is what I needed, thank you!

        Comment

        Working...
        X