Announcement

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

  • Disable variable expansion

    Hi,

    it happens the following, I write for example:

    Code:
    use "db.dta"
    [...]
    gen year = start + delta
    where `start` and `delta` are defined in `db.dta`.

    Then I realize I want to modify `start`.
    So for example taking the log.
    I then create a new variable and delete the old one, but I may forget to change the usage in later code.
    So I end up with:
    Code:
    use "db.dta"
    gen start2 = log(start)
    drop start
    [...]
    * forgot to change here :(
    gen year = start + delta
    Of course the formula for year is no longer valid.

    Other languages (R, Python), would throw an error here: `start` is not defined.

    But STATA "expands" the variable name and use `start2` instead of `start`.

    How can I deactivate this feature and get an error if the variable is not defined?


  • #2
    Code:
    help novarabbrev

    Comment


    • #3
      Thanks!

      Comment


      • #4
        So to disable it:
        Code:
        set varabbrev off

        Comment

        Working...
        X