Announcement

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

  • What is the best way to import data in a different language from excel and convert to English?

    Hello,

    I have an excel dataset in Arabic and I would like to work with the data in Stata in English. I can find and replace the data in excel and then import into Stata but I was wondering if there is a more efficient way of doing this in Stata (also so that there is a trail and less potential for mistakes).

    Thank you,

    Ona

  • #2
    I suppose there are two questions here. If you are asking whether Stata can translate other languages into English, the answer is no. But it can do -rename- and -replace- operations on your data set. I can't give examples in Arabic because I don't know any and don't even know how to create text that appears in Arabic script here. But let's use French as an example:

    Code:
    rename avant before
    rename paiement payment
    // etc.
    
    //  SUPPOSE var1-var10 ARE ALL DICHOTOMOUS
    //  VARIABLES RECORDED AS "OUI" OR "NON"
    foreach v of varlist var1-var10 {
        replace `v' = "YES" if `v' == "OUI"
        replace `v' = "NO" if `v' == "NON"
    }
    
    // OR BETTER STILL (TO CREATE LABELED 0/1 VARIABLES)
    label define yesno 0 "NON" 1 "OUI"
    foreach v of varlist var1-var10 {
        encode `v', gen(engl_`v') label(yesno)
        drop `v'
        rename engl_`v' `v'
    }
    label define yesno 0 "NO" 1 "YES", modify
    You can similarly use the -label var- command to apply English translations of the variable labels in your data set.

    But in all cases, you have to code in the English that corresponds to whatever is there in Arabic.

    Your do-file and log file with these commands are your audit trail for the translation process.

    Comment


    • #3
      Thanks very much Clyde

      Comment

      Working...
      X