Home  /  Products  /  Stata 10  /  Programming

This page announced updates in Stata 10. See a complete overview of all of Stata's programming features.

ORDER STATA

Programming

  1. First, a warning for time-series programmers: Stata’s new date/time values, which contain the number of milliseconds since 01jan1960 00:00:00, result in large numbers. 21apr2007 12:14:07.123 corresponds to 1,492,776,847,123. Date/time values must be stored as doubles. Programmers should use scalars to store these values whenever possible. If you must use a macro, exercise caution that the value is not rounded. It would not do at all for 1,492,776,847,123 to be recorded as “1.493e+12” (which would be 24apr2007 02:13:20). If you must use macros, our recommendations are

    1. If a date/time value is stored in one macro and you need it in another, code
              local new `old'
    2. If a date/time value is the result of an expression, and you must store it as a macro, code
              local new = string(exp, "\%21x")
      or
              local new : display %21x (exp)
    Now we will continue with What’s new.
  2. Stata for Windows now supports Automation, formerly known as OLE Automation, which means that programmers can control Stata from other applications and retrieve results. See [P] Automation.
  3. New command confirm {numeric | string | date} format verifies that the format is of the specified type; see [P] confirm.
  4. New function fmtwidth(s) returns the display width of a %fmt string, including date formats; see Programming functions in [D] functions.
  5. Expression limits have been increased in Stata/MP, Stata/SE, and Stata/IC. The limit on the number of dyadic operators has increased from 500 to 800, and the limit on the number of numeric literals has increased from 150 to 300. See help limits.
  6. Intercooled Stata has been renamed to Stata/IC. c(flavor) now contains IC rather than Intercooled if version≥10. Backward-compatibility old global macro $S_FLAVOR continues to contain Intercooled. See [P] creturn and [P] macro.
  7. c() now contains values associated with Stata/MP: c(MP) (1 or 0 depending on whether you are running Stata/MP), c(processors) (the number of processors being used), c(processors_mach) (the number of processors on the computer), c(processors_lic) (the maximum number of processors the license will allow you to use), c(processors_max) (the maximum number of processors that could be used on this computer with this license).
  8. New command include is a variation on do and run. include executes the commands stored in a file just as if they were entered from the keyboard or the current do-file. It is most often used in advanced Mata situations to create the equivalent of #include files. See [P] include.
  9. New commands signestimationsample and checkestimationsample are useful in writing estimation/postestimation commands that need to identify the estimation sample; see [P] signestimationsample.
  10. New command _datasignature is the building block for Stata’s datasignature command and the programming commands signestimationsample and checkestimationsample. In advanced situations, you may wish to call it directly. See [P] _datasignature.
  11. New extended macro function :copy copies one macro to another and is faster when the macro being copied is long. That is, coding
            local new : copy local old
    is faster than
            local new `old'
    See [P] macro.
  12. New command timer times sections of code; see [P] timer.
  13. Existing command matrix accum is now faster when some observations contain zeros; see [P] matrix accum.
  14. Existing command ml display has new option showeqns that requests that equation names be displayed in the coefficient table; see [R] ml.
  15. Existing command mkmat has new options rownames(), roweq(), rowprefix(), obs, and nchar() that specify the row names of the created matrix; see [P] matrix mkmat.
  16. Existing command _rmdcoll’s nocollin option has been renamed to normcoll. nocollin will continue to work as a synonym for normcoll.
  17. Existing command describe’s option simple no longer saves the names of the variables in r(varlist); you must specify option varlist if you want that. Also, existing command describe using filename now allows options simple and varlist.
  18. New extended macro function adosubdir returns the subdirectory in which Stata would search for a file along the ado-path. Determining the subdirectory in which Stata stores files is now a function of the file’s extension. Command adosubdir returns the subdirectory in which to look. See [P] macro.
  19. Existing command syntax { [ optionname(real ...) ] } now returns the number specified in %18.0g format if version is set to 10.0 or higher. For version less than 10, the number is returned in %9.0g format. See [P] syntax.
  20. New functions _byn1() and _byn2(), available within a byable(recall) program, return the beginning and ending observation numbers of the by-group currently being executed; see [P] byable.
  21. Existing command program drop may now specify program drop _allado to drop programs that were automatically loaded from ado-files; see [P] program.
  22. Concerning SMCL,

    1. Directive {synoptset} has new optional argument notes that specifies that some of the table entries will have footnotes and results in a larger indentation of the first column.
    2. Existing directive {p} now has an optional fourth argument specifying the paragraph’s width.
    See [P] smcl.
  23. For classes, you can now define an oncopy member program to perform operations when a copy of an object is being created. See [P] class.
  24. For programmable menus, the maximum number of menu items that can be added to Stata has increased to 1,250 from 1,000; see help window programming.
  25. Concerning programmable dialogs,

    1. Child dialogs can now be created.
    2. New control TEXTBOX allows displaying multiline text.
    3. In the dialog programming language, (1) if now allows else and (2) new command close closes the dialog programmatically.
    4. Messages can be passed to dialogs when they are launched; see help db.
    5. Dialogs can now be designated as modal, meaning that this dialog must be dealt with by the user before new dialogs (other than children) can be launched.
    6. Several controls have new options and new member programs. For instance, FILE and LISTBOX now have option multiselect, which lets the user pick more than one item.
    See help dialog programming.
  26. Stata’s help files are now named *.sthlp rather than *.hlp, meaning that user-written help files can be sent via email more easily. Many email filters flag .hlp files as potential virus carriers because Stata was not the only one to use the .hlp suffix. You need not rename your old help files. See [R] help.
  27. Two new C functions have been exposed from Stata for use by plugins: sstore() and sdata(). sstore() stores string data in the Stata dataset and sdata() reads them. See http://www.stata.com/plugins/.

Back to highlights