Announcement

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

  • Variable abbreviations in code examples in help files

    This is in the nature of a suggestion to the Stata team rather than a question.

    Many code examples in Stata help files break if you tend to use

    Code:
    set varabbrev off
    to disallow Stata from using variable abbreviations. Most recently, I came across this here:
    Code:
    help legend_options##remarks2
    Clicking one of the code links there results in:

    Code:
    . gr_example uslifeexp: line le_m le_f year, legend(pos(5) ring(0) label(1 "Male") label(2 "Female"))
    
    -> preserve
    
    -> sysuse uslifeexp, clear
    (US life expectancy, 1900–1999)
    
    ->  line le_m le_f year, legend(pos(5) ring(0) label(1 "Male") label(2 "Female"))
    variable le_m not found
    r(111);
    The same problem occurs in many examples provided across Stata's documentation.

    Keeping varabbrev off is considered good practice and is advised in many Stata style guides (including by the World Bank DIME group, Julian Reif's guide, etc).

    Given this, perhaps the Stata team could alter the code examples everywhere in the documentation to include the full variable names, so that they always work?
    Last edited by Hemanshu Kumar; 07 Mar 2025, 20:33.
Working...
X