Stata/Mata

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Mata is a matrix language for Stata that is separate from the original ado-style programming. It was introduced in version 9. It is an imperative language similar to the C programming language and was designed to be faster for user program dealing with matrices.

Variables[edit | edit source]

Variables in Mata have both an eltype and an orgtype. The eltype can be any of: real, complex, string, pointer, struct, numeric (real or complex), or transmorphic (any of the previous). All numbers in stata are stored as 8-byte doubles. The orgtype can be any of: scalar, vector, rowvector, colvector, or matrix.

Functions[edit | edit source]

All functions in Mata are pass-by-reference.