Announcement

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

  • loop for renaming variables

    Hi all,

    I hope you could help me because I am completely stump by this problem. I have short data:
    year and indicators for countries, e.g. AustraliaIndnation BelgiumIndnational etc. I would like to have countryInd to reshape my data, eg. AustraliaInd. I think I cannot write a loop using substr because the second part of the name differs slightly like Indnation Indnational

    The only thing which comes to my mind is to rename my variables manually. However, it would be time consuming
    Last edited by sladmin; 28 Aug 2023, 08:33. Reason: anonymize original poster

  • #2
    No data example, but perhaps

    Code:
    rename *Ind* *Ind
    See

    Code:
    h rename_group

    Comment


    • #3
      Thank you Andrew! It works for my data

      Comment

      Working...
      X