Announcement

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

  • Rename Inside of a Column

    Hello,

    Any idea how to rename the countries code within (code) column. For instance AD stands for the country of ANDORRA. I want to change it to a 3-character format like ADR as to make it easier to merge with World Bank Database.

    Cheers.
    Click image for larger version

Name:	Screenshot 2023-10-29 at 13.19.06.png
Views:	1
Size:	609.8 KB
ID:	1731925

  • #2

    This is a job for the replace command. You can replace values of a variable (the term to use here, better than column) with e.g.

    Code:
    replace code = "ADR" if code == "AD"

    Comment


    • #3
      Nick Cox Thank you ever so much, you've spared me much headache, and cheers for the remark.

      Comment


      • #4
        You might also want to look into Rafal Raciborski's -kountry- package, from SSC. It automates the process of translating among various country code systems and also their full names.

        Comment

        Working...
        X