Announcement

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

  • Adding prefix to all observations in column

    I have a column of identifiers which are e.g. :

    58473J
    50046Q
    22631J

    I would like to add a prefix in front of all these observations. How should I program this in stata?

  • #2
    how about:
    Code:
    gen newvar="pre"+id
    where I have assumed that id is the name of the current variable (not column) and the pre is the prefix you want to add; you will obviously need to change the name of the new variable, the name of the old variable and the substance of the prefix you want to add as appropriate; please read the FAQ before posting again (to make it easier for us to help you)

    Comment


    • #3
      Thank you , I will do that. This thread could be closed

      Comment

      Working...
      X