Search code examples
documentationstata

Can Stata help files be version specific?


Stata's ado packages quite nicely accommodate end users running different versions of Stata. For example:

program define MyGreatProgram

  if int(_caller())<8 {
    display as res "MyGreatProgram does not support this version of Stata, sorry."
    exit
  }
  else {
    if int(_caller())<14 {
      MyGreatProgram8 `0'
    }
    else { 
      MyGreatProgram14 `0'
    }
  } 
  end

Stata's improvements with newer versions have extended to improving the possibilities in help files. For example, in Stata versions 14+, one can incorporate Unicode, and this may be very helpful in documentation (e.g., Greek characters, mathematical operators, etc.). However, in my code above, an end user of MyGreatProgram running Stata version 11, would not find help files with Unicode especially legible, while a user running Stata 15 might think they looked just fine.

Is it possible to have Stata automatically recognize separate help files for different versions of Stata, or to embed version-specific directives into Stata .sthlp files?


Solution

  • The comment by @NickCox suggests the following kinda clunky, but definitely workable non-automated solution:

    • Write different help files for different versions/version ranges a la MyGreatProgram8.sthlp, MyGreatProgram14.sthlp, etc.

    • Write a "foyer" help file, MyGreatProgram.sthlp, which serves as a directory to version-specific help files a la:

      help MyGreatProgram
      -------------------------------------------------------
      
      Title
          MyGreatProgram -- Précis of MyGreatProgram
      
      Directory of MyGreatProgram documentation for
          [Stata v 8 to Stata v 13 users]
          [Stata v 14+ users]
      

    Where [Stata v 8 to Stata v 13 users] links to MyGreatProgram8.sthlp, and [Stata v 14+ users] links to MyGreatProgram14.sthlp.