This page contains only historical information and is not about the current
release of Stata.
Please see our Stata 13 page
for information on the current version of Stata.
Mata
For an introduction to Mata, click here.
Here’s what’s new in Stata 10

New Stata command
include is a variation on
do and
run
and is useful for implementing #include for
header files in advanced programming situations. See [P]
include and type
viewsource optimize.mata for an example of use.

Mata now has structures, which will be of special interest to those
writing large systems. See [M2]
struct and [M5]
liststruct().

Mata now engages in more thorough type checking, and produces better code,
for those who explicitly declare arguments and variables.

Mata inherits all of Stata’s formats and functions for dealing
with the new date/time variables and values; see [M5]
date() and [M5]
fmtwidth().

New functions inbase() and
frombase perform base conversions; see [M5]
inbase().

New function floatround() returns values rounded
to float precision. This is Mata’s equivalent of Stata’s
float()
function. See [M5]
floatround().

New function nameexternal() returns the name of
an external; see [M5]
findexternal().

Concerning matrix manipulation,

Matrix multiplication is now faster when one of the matrices contains
many zeros, as is function
cross().

Appending rows or columns to a matrix using , and \
is now faster.

New function _diag() replaces the principal
diagonal of a matrix with a specified vector or scalar; see [M5]
_diag().

New functions select() and
st_select() select rows or columns of a
matrix on the basis of a criterion; see [M5]
select().

Existing functions
rowsum(),
colsum(),
sum(),
quadrowsum(),
quadcolsum(), and
quadsum()
now allow an optional second argument that determines how missing
values are handled; see [M5]
sum().

New functions
runningsum(),
quadrunningsum(),
_runningsum(), and
_quadrunningsum()
return the running sum of a vector; see [M5]
runningsum().

New functions minindex() and
maxindex() return the indices of minimums
and maximums (including tied values) of a vector; see [M5]
minindex().

Concerning statistics,

New Mata function optimize() performs
minimization and maximization. You can code just the function, the
function and its first derivatives, or the function and its first and
second derivatives. Optimization techniques include
Newton–Raphson, Davidon–Fletcher–Powell,
Broyden–Fletcher–Goldfarb–Shanno,
Berndt–Hall–Hall–Hausman, and the simplex method
Nelder–Mead. See [M5]
optimize().

New function cvpermute() forms permutations;
see [M5]
cvpermute().

New function ghk() provides the
Geweke–Hajivassiliou–Keane multivariate normal
simulator; see [M5]
ghk().
New function ghkfast() is faster but a
little more difficult to use; see [M5]
ghkfast().

New functions halton(),
_halton(), and ghalton() compute
Halton and Hammersley sets; see [M5]
halton().

The new density and probability functions available in Stata are also
available in Mata, including
binomial(),
binomialtail(),
gammaptail(),
invgammaptail(),
invbinomialtail(),
ibetatail(),
invibetatail(),
lnnormal(), and
lnnormalden();
see [M5]
normal().
Also, as in Stata, convergence and accuracy of many of the
cumulatives, reverse cumulatives, and density functions have been
improved.

Existing Mata functions
mean(),
variance(),
quadvariance(),
meanvariance(),
quadmeanvariance(),
correlation(), and
quadcorrelation()
now make the weight argument optional.
If not specified, unweighted estimates are returned. See
[M5] mean().

Concerning string processing,

New function stritrim() replaces multiple,
consecutive internal spaces with one space; see [M5]
strtrim().

New functions strtoreal() and
_strtoreal() convert strings to numeric
values; see [M5]
strtoreal().

New function _substr() substitutes a
substring into an existing string; see [M5]
_substr().

New function invtokens() is the inverse of
the existing function tokens(); see [M5]
invtokens().

New function tokenget() performs advanced
parsing; see [M5]
tokenget().

Concerning I/O,

New function adosubdir() returns the subdirectory in
which Stata would search for a file; see [M5]
adosubdir().
New function
pathsearchlist(fn)
returns a row vector of full paths/filenames specifying all the
locations, in order, where Stata would look for the specified
fn along the official Stata adopath; see [M5]
pathjoin().

New function byteorder() returns 1 if the
computer is HILO and returns 2 if the computer is LOHI; see [M5]
byteorder().

New undocumented function st_fopen()
makes opening files easier; see
help mata
st_fopen().

New functions bufput() and
bufget() copy elements into and out of
buffers; see [M5]
bufio().

Existing function cat() now allows optional
second and third arguments that specify the beginning and ending lines
of the file to read; see [M5]
cat().

New functions ferrortext() and
freturncode() obtain error messages and return
codes following an I/O error; see [M5]
ferrortext().

Concerning the Stata interface,

New function stataversion() returns the version of Stata
that you are running, and new function statasetversion()
allows setting it. See [M5]
stataversion().

New function setmore() allows turning
more on and off. New function
setmoreonexit() allows restoring
more to its original setting when execution
ends. See [M5]
more().

New undocumented function st_lchar() allows
storing exceedingly long strings (such as a varlist) in Stata dataset
characteristics. See
help mata
st_lchar().
Back to highlights