Announcement

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

  • Stata code not working anymore

    Dear All,

    I looked around the forum and search but I don't really know what to look for, so I decided to post my question.
    I had some code working that I inherited from my former colleague and I didn't really looked at it since it was OK up to now.

    Since a few days, I have error occurring and after checking it seems logical that it's not working.

    For example, I have
    Code:
    duplicates drop code1 year code2, force
    and before this instruction I have
    Code:
    rename year year_u
    So it's pretty obvious why it's not working, but I also logged all previous launch and what I found out is that when it used to work I got this output
    Code:
    duplicates in terms of code1 year_u code2
    As if stata was using variable starting by year*. Does it make sense ? Is it an option I changed by mistake ?

    Thank you for your answer.

    Regards,
    Kevin

  • #2
    By default, when Stata parses a list of variables, if it encounters a string that is a prefix of a unique variable name, it interprets it as that variable. This default behavior can be overridden by changing a setting: -set varabbrev off- will cause Stata to accept only full variable names. So it's possible that you changed this setting somewhere along the line.

    Another possibility is that between the last time this code was run and now, the data have changed and, now, in addition to variable year_u, there is some other variable whose name begins with year, a variable that was not previously present in the data. In that case, Stata would not know which variable the prefix year refers to and it would throw an error.

    Comment

    Working...
    X