Announcement

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

  • (r110) error

    Hi, hope you are all well.

    When running these lines of code, I am getting the error (r110)

    preserve
    clear
    svmat R, names(col)
    gen loa="National", replace
    gen subgroup="National", replace
    order loa subgroup
    keep if _n==1
    save "$datos/ag_nat", replace
    Restore
    svmat R, names(col)
    new variables cannot be uniquely named or already defined
    r(110); t=0.01 10:26:26

    Can anyone help me?

  • #2
    There is no -replace- option for the -gen- command. -replace- is a separate command in its own right. The error message you are getting is self-explanatory: you have attempted to -gen- a variable that already exists. That isn't allowed. You must -replace loa = "National"- and -replace subgroup = "National"- if those variables already exist. They will already exist if matrix R has columns named loa or subgroup.

    Another possible problem here is the final -svmat- command. It is not possible to tell from the code shown what variables will be in memory at the time that command is executed. It is the same as whatever was in memory at the very start of the code, because you -preserve-d it and then -restore- it just before the final -svmat-. If any of the column names in matrix R is the same as the name of a variable in memory, then the -svmat- will fail and give you this same error message because, again, once a variable exists, you can't create it (and -svmat- creates variables with names corresponding to the columns of the matrix).

    Comment

    Working...
    X