Announcement

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

  • Question on the possibility of testing impacts of "set varabbrev off, permanently"

    Dear Stata Forum users,

    I have recently encountered an issue in my Stata code, whereby the abbreviation was causing an issue depending on the order of renames:
    Code:
    capture rename X Y
    capture rename X1 Y1
    In the above instance if I do not have the variable X, but I do have X1, X1 gets renamed to "Y" and the second line fails.

    The solution was to use "set varabbrev off". However, the entire stata script (a series of .do files linked using "include/do") is thousands and thousands of lines of code.One concern is that setting abbreviations off may solve this particular issue, but cause issues elsewhere in the code. I was hoping to run the code with abbreviations on and off, but due to the nature of the code (we have many capture lines as for any specific execution, only some lines are used, think a complicated model with constantly changing inputs) it is quite difficult to properly test if setting abbreviations off will not impact the code.

    One solution is to use "set varabbrev off" then "set varabbrev on" after the rename, but I was hoping to use "set varabbrev off, perm" in the starting lines to entirely do away with abbreviations which might hurt the code executions later on down the line.

    My question is: Does Stata keep a count of how many abbreviations are used, or does it record anything when an abbreviation is used?

    If no, would anyone have any good strategies to figure out how changing this setting might impact the stata code?

    Thank you for your time and patience,
    Henry

  • #2
    Double post. Please follow this thread instead.

    Comment

    Working...
    X