Announcement

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

  • converting sequence numbers to odd numbers

    Hi,
    I was wondering to know how can I convert sequence numbers to odd numbers in stata. I have a dataset which has a column containing sequence numbers (1,2,3,4,5, ...). I wanna convert it to 1, 3, 5, etc. (1 to 1, 2 to 3, 3 to 5, 4 to 7, etc).
    Thanks,
    Nader

  • #2
    For column read variable. Otherwise school mathematics helps:

    Code:
    replace whatever = 2 * whatever - 1 

    Comment

    Working...
    X