»  Home »  Resources & support »  User Group Meetings »  1999 UK Stata Users Group meeting »  Writing extensions to predict, continued

Writing extensions to predict, continued

  • usage: _pred_se "options your extension will handle" `0'
  • _pred_se returned results:
    s(done)  _pred_se handled a standard case
    s(varn)  name of new variable to generate
    s(typ)  datatype of new variable to generate
    s(rest)  command line for custom predictor to parse

  • Example:
           program define mycmd6_p
               local myopts "new-predict-options"
               _pred_se "`myopts'" `0'
               if `s(done)' { exit }
               local vtyp `s(typ)'
               local varn `s(varn)'
               local 0    `"`s(rest)'"'
               syntax [if] [in] [, `myopts' noOFFset]
  • mycmd6_p must handle default case of no options specified
  • mycmd6_p also handles cases when one of the options in `myopts' is specified





The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn YouTube Instagram
© Copyright 1996–2022 StataCorp LLC   •   Terms of use   •   Privacy   •   Contact us