Programming

  • 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:

    • If a date/time value is stored in one macro and you need it in another, code
                local new `old'
    • 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)
  • 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.

  • New command confirm {numeric | string | date} format verifies that the format is of the specified type; see [P] confirm.

  • New function fmtwidth(s) returns the display width of a %fmt string, including date formats; see Programming functions in [D] functions.

  • 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.

  • 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.

  • 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).

  • 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.

  • New commands signestimationsample and checkestimationsample are useful in writing estimation/postestimation commands that need to identify the estimation sample; see [P] signestimationsample.

  • 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.

  • 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.

  • New command timer times sections of code; see [P] timer.

  • Existing command matrix accum is now faster when some observations contain zeros; see [P] matrix accum.

  • Existing command ml display has new option showeqns that requests that equation names be displayed in the coefficient table; see [R] ml.

  • 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.

  • Existing command _rmdcoll’s nocollin option has been renamed to normcoll. nocollin will continue to work as a synonym for normcoll.

  • 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.

  • 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.

  • 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.

  • 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.

  • Existing command program drop may now specify program drop _allado to drop programs that were automatically loaded from ado-files; see [P] program.

  • Concerning SMCL,
  • See help dialog programming.


    Back to What is New in Stata 10

    Request a quotation for your upgrade

    Price lists


    Back to Stata homepage
    Back to Timberlake Consultants

    ©Timberlake Consultants Limited
    Last revised:09/07/2007