Stata 15 help for mata

[M-0] intro -- Introduction to the Mata manual


Section Description ----------------------------------------------------- [M-1] Introduction and advice

[M-2] Language definition

[M-3] Commands for controlling Mata

[M-4] Categorical guide to Mata functions

[M-5] Alphabetical index to Mata functions

[M-6] Mata glossary of common terms -----------------------------------------------------


Mata is a matrix programming language that can be used by those who want to perform matrix calculations interactively and by those who want to add new features to Stata.

The Mata Reference Manual is comprehensive. If it seems overly comprehensive and too short on explanation as to why things work the way they do and how they could be used, we have a suggestion. See The Mata Book by William Gould (428 pages) or An Introduction to Stata Programming by Christopher Baum (412 pages). Baum's book assumes that you are familiar with Stata but new to programming. Gould's book assumes that you have some familiarity with programming and goes on from there. The books go well together.


This manual is divided into six sections. Each section is organized alphabetically, but there is an introduction in front that will help you get around.

If you are new to Mata, here is a helpful reading list: start by reading

------------------------------------------------------------- [M-1] first Introduction and first session [M-1] interactive Using Mata interactively [M-1] how How Mata works -------------------------------------------------------------

You may find other things in section [M-1] that interest you. For a table of contents, see

------------------------------------------------------------- [M-1] intro Introduction and advice -------------------------------------------------------------

Whenever you see a term that you are unfamiliar with, see

------------------------------------------------------------- [M-6] Glossary Mata glossary of common terms -------------------------------------------------------------

Now that you know the basics, if you are interested, you can look deeper into Mata's programming features:

------------------------------------------------------------- [M-2] syntax Mata language grammar and syntax -------------------------------------------------------------

[M-2] syntax is pretty dense reading, but it summarizes nearly everything. The other entries in [M-2] repeat what is said there but with more explanation; see

------------------------------------------------------------- [M-2] intro Language definition -------------------------------------------------------------

because other entries in [M-2] will interest you. If you are interested in object-oriented programming, be sure to see [M-2] class.

Along the way, you will eventually be guided to sections [M-4] and [M-5]. [M-5] documents Mata's functions; the alphabetical order makes it easy to find a function if you know its name but makes learning what functions there are hopeless. That is the purpose of [M-4] -- to present the functions in logical order. See

------------------------------------------------------------- [M-4] intro Categorical guide to Mata functions

Mathematical [M-4] matrix Matrix functions [M-4] solvers Matrix solvers and inverters [M-4] scalar Scalar functions [M-4] statistical Statistical functions [M-4] mathematical Other important functions

Utility and manipulation [M-4] standard Functions to create standard matrices [M-4] utility Matrix utility functions [M-4] manipulation Matrix manipulation functions

Stata interface [M-4] stata Stata interface functions

String, I/O, and programming [M-4] string String functions [M-4] io I/O functions [M-4] programming Programming functions -------------------------------------------------------------


Baum, C. F. 2016. An Introduction to Stata Programming. 2nd ed. College Station, TX: Stata Press.

Gould, W. W. 2018. The Mata Book: A Book for Serious Programmers and Those Who Want to Be. College Station, TX: Stata Press.

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index