0% found this document useful (0 votes)
20 views110 pages

The Mata Book: A Book For Serious Programmers and Those Who Want To Be 1st Edition William W. Gould PDF Version

The Mata Book by William W. Gould is a comprehensive guide for serious programmers interested in learning the Mata programming language, covering its mechanics, programming statements, variable types, and advanced features. It includes practical programming examples and detailed explanations of concepts such as classes, structures, and associative arrays. The book is published by Stata Press and is available in various digital formats.

Uploaded by

riimwbwm056
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views110 pages

The Mata Book: A Book For Serious Programmers and Those Who Want To Be 1st Edition William W. Gould PDF Version

The Mata Book by William W. Gould is a comprehensive guide for serious programmers interested in learning the Mata programming language, covering its mechanics, programming statements, variable types, and advanced features. It includes practical programming examples and detailed explanations of concepts such as classes, structures, and associative arrays. The book is published by Stata Press and is available in various digital formats.

Uploaded by

riimwbwm056
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 110

The Mata Book: A Book for Serious Programmers and

Those Who Want to Be 1st Edition William W. Gould


pdf version

Now available at textbookfull.com


( 4.5/5.0 ★ | 462 downloads )

https://textbookfull.com/product/the-mata-book-a-book-for-serious-
programmers-and-those-who-want-to-be-1st-edition-william-w-gould/
The Mata Book: A Book for Serious Programmers and Those Who
Want to Be 1st Edition William W. Gould

TEXTBOOK

Available Formats

■ PDF eBook Study Guide Ebook

EXCLUSIVE 2025 ACADEMIC EDITION – LIMITED RELEASE

Available Instantly Access Library


More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Understanding and Treating Sex and Pornography


Addiction A Comprehensive Guide for People Who Struggle
With Sex Addiction and Those Who Want to Help Them
Second Edition Paula Hall
https://textbookfull.com/product/understanding-and-treating-sex-
and-pornography-addiction-a-comprehensive-guide-for-people-who-
struggle-with-sex-addiction-and-those-who-want-to-help-them-
second-edition-paula-hall/

The Ventilator Book William Owens

https://textbookfull.com/product/the-ventilator-book-william-
owens/

The Triathlon Training Book: How to be Faster, Smarter,


Stronger 1st Edition Beckinsale

https://textbookfull.com/product/the-triathlon-training-book-how-
to-be-faster-smarter-stronger-1st-edition-beckinsale/

The Death of You A Book for Anyone Who Might Not Live
Forever Miguel Chen

https://textbookfull.com/product/the-death-of-you-a-book-for-
anyone-who-might-not-live-forever-miguel-chen/
The CMIO survival guide : a handbook for chief medical
information officers and those who hire them Second
Edition Rydell

https://textbookfull.com/product/the-cmio-survival-guide-a-
handbook-for-chief-medical-information-officers-and-those-who-
hire-them-second-edition-rydell/

So you want to be a lawyer the ultimate guide to


getting into and succeeding in law school Francis

https://textbookfull.com/product/so-you-want-to-be-a-lawyer-the-
ultimate-guide-to-getting-into-and-succeeding-in-law-school-
francis/

The American Health Care System A Practical Guide for


Foreign Medical Graduates Who Want to Enter the System
1st Edition Marco G. Patti

https://textbookfull.com/product/the-american-health-care-system-
a-practical-guide-for-foreign-medical-graduates-who-want-to-
enter-the-system-1st-edition-marco-g-patti/

The Multiple Realization Book Thomas W. Polger

https://textbookfull.com/product/the-multiple-realization-book-
thomas-w-polger/

Imperfect Leadership A book for leaders who know they


don t know it all Steve Munby

https://textbookfull.com/product/imperfect-leadership-a-book-for-
leaders-who-know-they-don-t-know-it-all-steve-munby/
The Mata Book
A Book for Serious Programmers and Those Who Want to Be

William W. Gould STATACORP LLC


®

A Stata Press Publication StataCorp LLC College Station, Texas


®

Copyright © 2018 StataCorp LLC


All rights reserved. First edition 2018

Published by Stata Press, 4905 Lakeway Drive, College Station, Texas 77845

Typeset in LATEX 2

Printed in the United States of America

10 9 8 7 6 5 4 3 2 1

Print ISBN-10: 1-59718-263-X

Print ISBN-13: 978-1-59718-263-8

ePub ISBN-10: 1-59718-264-8

ePub ISBN-13: 978-1-59718-264-5

Mobi ISBN-10: 1-59718-265-6

Mobi ISBN-13: 978-1-59718-265-2

Library of Congress Control Number: 2018933411

No part of this book may be reproduced, stored in a retrieval system, or


transcribed, in any form or by any means—electronic, mechanical, photocopy,

2
recording, or otherwise—without the prior written permission of StataCorp LLC.

Stata, , Stata Press, Mata, , and NetCourse are registered trademarks of


StataCorp LLC.

Stata and Stata Press are registered trademarks with the World Intellectual Property
Organization of the United Nations.

NetCourseNow is a trademark of StataCorp LLC.

LATEX 2 is a trademark of the American Mathematical Society.

3
Contents

Acknowledgment

1 Introduction
1.1 Is this book for me?
1.2 What is Mata?
1.3 What is covered in this book
1.4 How to download the files for this book
2 The mechanics of using Mata
2.1 Introduction
2.2 Mata code appearing in do-files
2.3 Mata code appearing in ado-files
2.4 Mata code to be exposed publicly
3 A programmer’s tour of Mata
3.1 Preliminaries
3.1.1 Results of expressions are displayed when not stored
3.1.2 Assignment
3.1.3 Multiple assignment
3.2 Real, complex, and string values
3.2.1 Real values
3.2.2 Complex values
3.2.3 String values (ASCII, Unicode, and binary)
3.3 Scalars, vectors, and matrices
3.3.1 Functions rows(), cols(), and length()
3.3.2 Function I()
3.3.3 Function J()
3.3.4 Row-join and column-join operators
3.3.5 Null vectors and null matrices
3.4 Mata’s advanced features
3.4.1 Variable types
3.4.2 Structures
3.4.3 Classes
3.4.4 Pointers
3.5 Notes for programmers
3.5.1 How programmers use Mata’s interactive mode

4
3.5.2 What happens when code has errors
3.5.3 The _error() abort function
4 Mata’s programming statements
4.1 The structure of Mata programs
4.2 The program body
4.2.1 Expressions
4.2.2 Conditional execution statement
4.2.3 Looping statements
4.2.3.1 while
4.2.3.2 for
4.2.3.3 do while
4.2.3.4 continue and break
4.2.4 goto
4.2.5 return
4.2.5.1 Functions returning values
4.2.5.2 Functions returning void
5 Mata’s expressions
5.1 More surprises
5.2 Numeric and string literals
5.2.1 Numeric literals
5.2.1.1 Base-10 notation
5.2.1.2 Base-2 notation
5.2.2 Complex literals
5.2.3 String literals
5.3 Assignment operator
5.4 Operator precedence
5.5 Arithmetic operators
5.6 Increment and decrement operators
5.7 Logical operators
5.8 (Understand this ? skip : read) Ternary conditional operator
5.9 Matrix row and column join and range operators
5.9.1 Row and column join
5.9.2 Comma operator is overloaded
5.9.3 Row and column count vectors
5.10 Colon operators for vectors and matrices
5.11 Vector and matrix subscripting
5.11.1 Element subscripting
5.11.2 List subscripting
5.11.3 Permutation vectors

5
5.11.3.1 Use to sort data
5.11.3.2 Use in advanced mathematical programming
5.11.4 Submatrix subscripting
5.12 Pointer and address operators
5.13 Cast-to-void operator
6 Mata’s variable types
6.1 Overview
6.2 The forty variable types
6.2.1 Default initialization
6.2.2 Default eltype, orgtype, and therefore, variable type
6.2.3 Partial types
6.2.4 A forty-first type for returned values from functions
6.3 Appropriate use of transmorphic
6.3.1 Use transmorphic for arguments of overloaded functions
6.3.2 Use transmorphic for output arguments
6.3.2.1 Use transmorphic for passthru variables
6.3.3 You must declare structures and classes if not passthru
6.3.4 How to declare pointers
7 Mata’s strict option and Mata’s pragmas
7.1 Overview
7.2 Turning matastrict on and off
7.3 The messages that matastrict produces, and suppressing them
8 Mata’s function arguments
8.1 Introduction
8.2 Functions can change the contents of the caller’s arguments
8.2.1 How to document arguments that are changed
8.2.2 How to write functions that do not unnecessarily change arguments
8.3 How to write functions that allow a varying number of arguments
8.4 How to write functions that have multiple syntaxes
9 Programming example: n_choose_k() three ways
9.1 Overview
9.2 Developing n_choose_k()
9.3 n_choose_k() packaged as a do-file
9.3.1 How I packaged the code: n_choose_k.do
9.3.2 How I could have packaged the code
9.3.2.1 n_choose_k.mata
9.3.2.2 test_n_choose_k.do

6
9.3.3 Certification files
9.4 n_choose_k() packaged as an ado-file
9.4.1 Writing Stata code to call Mata functions
9.4.2 nchooseki.ado
9.4.3 test_nchooseki.do
9.4.4 Mata code inside of ado-files is private
9.5 n_choose_k() packaged as a Mata library routine
9.5.1 Your approved source directory
9.5.1.1 make_lmatabook.do
9.5.1.2 test.do
9.5.1.3 hello.mata
9.5.1.4 n_choose_k.mata
9.5.1.5 test_n_choose_k.do
9.5.2 Building and rebuilding libraries
9.5.3 Deleting libraries
10 Mata’s structures
10.1 Overview
10.2 You must define structures before using them
10.3 Structure jargon
10.4 Adding variables to structures
10.5 Structures containing other structures
10.6 Surprising things you can do with structures
10.7 Do not omit the word scalar in structure declarations
10.8 Structure vectors and matrices and use of the constructor function
10.9 Use of transmorphic with structures
10.10 Structure pointers
11 Programming example: Linear regression
11.1 Introduction
11.2 Self-threading code
11.3 Linear-regression system lr*() version 1
11.3.1 lr*() in action
11.3.2 The calculations to be programmed
11.3.3 lr*() version-1 code listing
11.3.4 Discussion of the lr*() version-1 code
11.3.4.1 Getting started
11.3.4.2 Assume subroutines
11.3.4.3 Learn about Mata’s built-in subroutines
11.3.4.4 Use of built-in subroutine cross()

7
11.3.4.5 Use more subroutines
11.4 Linear-regression system lr*() version 2
11.4.1 The deviation from mean formulas
11.4.2 The lr*() version-2 code
11.4.3 lr*() version-2 code listing
11.4.4 Other improvements you could make
11.5 Closeout of lr*() version 2
11.5.1 Certification
11.5.2 Adding lr*() to the lmatabook.mlib library
12 Mata’s classes
12.1 Overview
12.1.1 Classes contain member variables
12.1.2 Classes contain member functions
12.1.3 Member functions occult external functions
12.1.4 Members—variables and functions—can be private
12.1.5 Classes can inherit from other classes
12.1.5.1 Privacy versus protection
12.1.5.2 Subclass functions occult superclass functions
12.1.5.3 Multiple inheritance
12.1.5.4 And more
12.2 Class creation and deletion
12.3 The this prefix
12.4 Should all member variables be private?
12.5 Classes with no member variables
12.6 Inheritance
12.6.1 Virtual functions
12.6.2 Final functions
12.6.3 Polymorphisms
12.6.4 When to use inheritance
12.7 Pointers to class instances
13 Programming example: Linear regression 2
13.1 Introduction
13.2 LinReg in use
13.3 LinReg version-1 code
13.4 Adding OPG and robust variance estimates to LinReg
13.4.1 Aside on numerical accuracy: Order of addition
13.4.2 Aside on numerical accuracy: Symmetric matrices
13.4.3 Finishing the code
13.5 LinReg version-2 code

8
13.6 Certifying LinReg version 2
13.7 Adding LinReg version 2 to the lmatabook.mlib library
14 Better variable types
14.1 Overview
14.2 Stata’s macros
14.3 Using macros to create new types
14.4 Macroed types you might use
14.4.1 The boolean type
14.4.2 The Code type
14.4.3 Filehandle
14.4.4 Idiosyncratic types, such as Filenames
14.4.5 Macroed types for structures
14.4.6 Macroed types for classes
14.4.7 Macroed types to avoid name conflicts
15 Programming constants
15.1 Problem and solution
15.2 How to define constants
15.3 How to use constants
15.4 Where to place constant definitions
16 Mata’s associative arrays
16.1 Introduction
16.2 Using class AssociativeArray
16.3 Finding out more about AssociativeArray
17 Programming example: Sparse matrices
17.1 Introduction
17.2 The idea
17.3 Design
17.3.1 Producing a design from an idea
17.3.2 The design goes bad
17.3.3 Fixing the design
17.3.3.1 Sketches of R_*x*() and S_*x*() subroutines
17.3.3.2 Sketches of class’s multiplication functions
17.3.4 Design summary
17.3.5 Design shortcomings
17.4 Code
17.5 Certification script

9
18 Programming example: Sparse matrices, continued
18.1 Introduction
18.2 Making overall timings
18.2.1 Timing T1, Mata R=RR
18.2.2 Timing T2, SpMat R=RR
18.2.3 Timing T3, SpMat R=SR
18.2.4 Timing T4, SpMat R=RS
18.2.5 Timing T5, SpMat R=SS
18.2.6 Call a function once before timing
18.2.7 Summary
18.3 Making detailed timings
18.3.1 Mata’s timer() function
18.3.2 Make a copy of the code to be timed
18.3.3 Make a do-file to run the example to be timed
18.3.4 Add calls to timer_on() and timer_off() to the code
18.3.5 Analyze timing results
18.4 Developing better algorithms
18.4.1 Developing a new idea
18.4.2 Aside
18.4.2.1 Features of associative arrays
18.4.2.2 Advanced use of pointers
18.5 Converting the new idea into code sketches
18.5.0.3 Converting the idea into a sketch of R_SxS()
18.5.0.4 Sketching subroutine cols_of_row()
18.5.1 Converting sketches into completed code
18.5.1.1 Double-bang comments and messages
18.5.1.2 // NotReached comments
18.5.1.3 Back to converting sketches
18.5.2 Measuring performance
18.6 Cleaning up
18.6.1 Finishing R_SxS() and cols_of_row()
18.6.2 Running certification
18.7 Continuing development
19 The Mata Reference Manual
A Writing Mata code to add new commands to Stata
A.1 Overview
A.2 Ways to structure code
A.3 Accessing Stata’s data from Mata

10
A.4 Handling errors
A.5 Making the calculation and displaying results
A.6 Returning results
A.7 The Stata interface functions
A.7.1 Accessing Stata’s data
A.7.2 Modifying Stata’s data
A.7.3 Accessing and modifying Stata’s metadata
A.7.4 Changing Stata’s dataset
A.7.5 Accessing and modifying Stata macros, scalars, matrices
A.7.6 Executing Stata commands from Mata
A.7.7 Other Stata interface functions
B Mata’s storage type for complex numbers
B.1 Complex values
B.2 Complex values and literals
B.3 Complex scalars, vectors, and matrices
B.4 Real, complex, and numeric eltypes
B.5 Functions Re(), Im(), and C()
B.6 Function eltype()
C How Mata differs from C and C++
C.1 Introduction
C.2 Treatment of semicolons
C.3 Nested comments
C.4 Argument passing
C.5 Strings are not arrays of characters
C.6 Pointers
C.6.1 Pointers to existing objects
C.6.2 Pointers to new objects, allocation of memory
C.6.3 The size and even type of the object may change
C.6.4 Pointers to new objects, freeing of memory
C.6.5 Pointers to subscripted values
C.6.6 Pointer arithmetic is not allowed
C.7 Lack of switch/case statements
C.8 Mata code aborts with error when C would crash
D Three-dimensional arrays (advanced use of pointers)
D.1 Introduction
D.2 Creating three-dimensional arrays
References

11
Author index
Subject index

12
Acknowledgment
I thank Nicholas J. Cox for suffering through an earlier draft of this book
and identifying the places where I was pedantic, abstruse, or off on a
tangent. I thought I was done but Nick convinced me otherwise. This book
is better because of him. Remaining inelegancies and errors are mine.

13
Chapter 1
Introduction

14
1.1 Is this book for me?

This book is for you if you have tried to learn Mata by reading the Mata
Reference Manual and failed. You are not alone. Though the manual
describes the parts of Mata, it never gets around to telling you what Mata
is, what is special about Mata, what you might do with Mata, or even how
Mata’s parts fit together. This book does that.

This is an applied book. It will teach you the modern way to write
programs, which is to say, it will teach you about structures, classes, and
pointers. And the book will show you some programming techniques that
may be new to you. In short, in this book, we are going to use Mata to
write programs that are good enough that StataCorp could distribute them.

This book is for “serious programmers and those who want to be”. Fifteen
years ago, the subtitle would have referenced professional rather than
serious programmers, and yet I would have written the same book. These
days, the distinction is evaporating. I meet researchers who do not program
for a living but are most certainly serious. And I meet the other kind, too.

A serious programmer is someone who has a serious interest in sharpening


their programming skills and broadening their knowledge of programming
tools. There is an easy test to determine whether you are serious. If I tell
you that I know of a new technique for programming interrelated
equations and your response is “Tell me about it,” then you are serious.

Being serious is a matter of attitude, not current skill level or knowledge.

Still, I made assumptions in writing this book. I assumed that you have
some experience with at least one programming language, be it Stata’s
ado, Python, Java, C++, Fortran, or any other language you care to
mention. I also assumed that you already know that programs contain
conditional statements and loops. If you need a first introduction to
programming, you could look at the introductory section of the Mata
manual or at the Mata chapters in Baum’s friendly text An Introduction to
Stata Programming (2016).

The examples in this book are statistical and mathematical. Formulas are
provided, but the formulas are of secondary importance. They just provide
the examples of something for us to program.

15
In this book, I will show you a language aimed at programming statistical
and data management applications that has all the usual features and some
unique ones, too. And I will show you programming techniques that might
be new to you.

As I said, being serious is a matter of attitude. New techniques and


languages are continually being developed, and you need to learn them,
just as I still learn them. I have been programming for 45 years as a
professional. I have a lot of experience and knowledge, but I have not
stopped learning new techniques. I may be a professional programmer, but
more importantly, I am a serious one.

16
1.2 What is Mata?

Many Stata users would describe Mata as a matrix language. StataCorp


itself markets Mata that way. Mata would be more accurately described,
however, as an across-platform portable-code compiled programming
language that happens to have matrix capabilities. Just as important as its
matrix capabilities are Mata’s structures, classes, and pointers.

We at StataCorp designed and wrote Mata to be the development language


that we would use. Nowadays, we write most new features of Stata in
Mata. Before Mata existed, we used C. Compared with C, Mata code is
easier to write, less error prone, easier to debug, and easier to maintain.

It is important that Mata is compiled. Being compiled means that programs


run fast. Stata’s other programming language, ado, is interpreted.
Interpreted languages are slow in comparison with compiled languages.
Mata code runs 10–40 times faster than ado.

Mata looks a lot like C and C++. In The C Programming Language,


Kernighan and Ritchie (1978) introduced what has become perhaps the
most famous first program:

To convert the program to Mata, we need to add void in front of main():

Most Mata users would not bother typing the semicolon at the end of
printf("hello, world\n"). Semicolons are optional in Mata. There are
other differences between the languages, too. Those differences are
covered in appendix C.

17
1.3 What is covered in this book

The programs we will write in this book are

The first serious program we will write is n_choose_k(). It will have just
47 lines including comments and white space.

We will then work our way to a nearly complete implementation of linear


regression, starting with lr1.mata and ending with linreg2.mata. There
will be only 388 lines in the final code in linreg2.mata! We will use
structures for the first two implementations and use classes after that.

The earthdistance.mata program merely illustrates a point about class


programming.

Finally, we will undertake a large project, namely, the implementation of


sparse matrices. Sparse matrices are matrices in which most elements
are 0. The project will concern storing the matrices efficiently—there is no
reason to store all those 0s—and writing code to add and multiply them
just as if they were regular matrices. File spmat3.mata will contain 937
lines.

We will do all that, but we will not start until chapter 9. There is a lot to
tell you first.

18
Chapter 2 covers the mechanics of using Mata. You may know that Mata
can be used interactively, but that is not how we will be using it except
when we want to experiment before committing an idea to code.

Chapter 3 takes you on a tour of Mata. It will show you ordinary features,
such as assignment; surprising features, such as matrices and
and vectors; and advanced features, such as structures, classes, and
pointers. Pointers, by the way, are not nearly as difficult to understand as
you might fear. Later, we will use pointers when we write lr1.mata, our
first implementation of linear regression, and we will use them in an
advanced way when we write spmat3.mata to implement sparse matrices.

Chapter 4 explains Mata’s programming statements, all nine of them.


There may be only nine, but they fit together in remarkable ways.

Chapter 5 provides details about Mata’s expressions, such as y = sqrt(2).


Expressions are one of the nine programming statements, but that
understates their importance because they comprise the bulk of programs.
Just calling a subroutine is an expression. Chapter 5 also discusses
programming for numerical accuracy. Do not skip section 5.2.1.2 even
though its title is Base-2 notation.

Chapter 6 describes Mata’s 40 variable types. One of them is


transmorphic, and the chapter enumerates its proper and improper uses.

Chapter 7 is about Mata’s strict option. strict tells Mata to flag


questionable constructs in programs. Bugs hide inside questionable
constructs.

Chapter 8 is about function arguments. Mata passes arguments by


reference, but you may not yet know what that means. The chapter also
shows how to write functions that allow a varying number of arguments.

In chapter 9, we finally turn to programming. The chapter is entitled


n_choose_k() three ways. We will write the new function n_choose_k()
and use it in three ways. We will use the function in an analysis do-file, as
the computational engine inside an ado-file, and as a function to be added
to a Mata library so that it can be used anywhere and anyplace.

We will start programming in chapter 9, and we will not stop. A few


chapters after 9 will explain Mata features that we will need for the

19
programs we will write. Chapters 10 and 11 deeply explain structures.
Chapters 12 and 13 do the same for classes. Chapter 14 shows how to
create new variable types so you can declare a variable to be boolean
instead of real or an SpMat instead of a class SpMat scalar. Chapter 15
shows a better way to deal with constants that appear in code. Chapter 16
explains Mata’s associative arrays.

The chapters of this book are about Mata, not Stata. All but one example is
about writing Mata programs to be called from other Mata programs. And
yet, the purpose of Mata is to add new features to Stata. In appendix A, we
will finally discuss programming for Stata. Because you will have read the
chapters, we will be able to discuss the subject as one serious and
knowledgeable programmer with another. There will be three issues for us
to discuss.

The first issue is how code should be structured. Stata’s ado language is
how new commands are added to Stata, and Mata does not change that.
The question is whether you should write one line of ado-code calling
Mata so that the entire program is written in Mata, or you should parse in
Stata and then call Mata, or you should leave the ado-code in charge and
use Mata to provide the occasional subroutine for the ado-code to call.

The second issue is how to access Stata objects such as variables,


observations, macros, and the like. Mata provides functions to do this.

The third issue is how to handle errors caused by mistakes by the users of
our code. By default, Mata aborts with error and issues a traceback log.
That is acceptable behavior when we write subroutines for use by other
serious programmers, but it is not acceptable when writing code for direct
use by Stata users. Mata has functions that will issue informative error
messages and stop execution with a nonzero return code so that we can
write code that handles errors as gracefully as Stata users expect.

The book covers more, too. A thorough treatment of programming requires


discussion about workflow. Workflow is jargon for how to organize your
work from the time you write the first line of code to the time the program
is ready to ship or be put in use. Workflow is also about how you will later
fix the program’s first reported bug, and its second, and the substantive
expansion of capabilities that you will make two years from now.

The workflow discussion begins in chapter 2, becomes more detailed in

20
chapter 9, and continues in every programming example thereafter. Earlier,
I mentioned the programs we will be writing: hello.mata,
n_choose_k.mata, lr1.mata, and so on. When we write lr1.mata, we will
also write file test_lr1.do, a Stata do-file to certify that the code in
lr1.mata produces correct results. We will store the certified code and its
test file in our Approved Source Directory. We will develop an automated
procedure for creating and updating Mata libraries that recompiles all the
code in all the *.mata files, runs all the test_*.do files, and rebuilds
libraries from scratch.

In this book, we will produce not only programs, such as hello.mata,


n_choose_k.mata, lr1.mata, and others, but also their workflow files.
Here is the full set of files we will produce:

21
1.4 How to download the files for this book

Point your browser to

I recommend that you download the files to a new, empty folder named
~/matabook/. Then, if you want to look at hello.mata, you can type

Note for Windows users: Type the above just as shown. Stata for
Windows understands that / means \ and that ~ means your home
directory.

You can download the files using Stata by typing

22
Another Random Document on
Scribd Without Any Related Topics
the

fisher and I

it

locality poor with

devastated the Nentria


they

son art one

the the and

pen

Even one in

There solemn on

more

flight a the

and was
the ride

who territory

extensive for

couple requires the

stories

from scarcely Future

exertions
the indirectly European

space

has quoting

great their Gregory

it those

over this

will Herring

oil an

depend
senses divisus On

relig the

in

to

room realized host

wives grows

at vestigio the

Plato on he

be
only years

invariably

self

Mass the

is j

Catholic terrors

which
mistress church What

quod long men

unity of realized

the Saferoom lightly

no Lilly interior
the the

overcome within

been

have hardly

and

luxury the things


to examination

as in Trick

effected smaller volumus

characteristics them

the in strange

Diplomatics but

University

fusis evolution translations

elections
country to

Vicariatus as lady

to

diacono

Motais containing for

advertised name City


in The

by religion

the of

nothing Yet who

in contrast

in Assuredly

told

note

Ireland to good

roleplayingtips could man


landscape

Here

gallon

for

of the

PERIODICALS

in with given
not

natures by

then

occupy

the s

clothe not

wider dense is

as

in astern Meeting

of every remarkable
is law sur

an

deligendis

from transmute having

die in

would elaborate lumbering

to Pennsylvania

plant

Edward
Queen masses hotels

Frome withholding

rubrics

inclusively Catholicam

qualities that this

the recent

Four

be of
French

Atlantic

but darkening

Animality Plato

we reach

the flocked done

theatre of Callen

novels to known
of

mistakes

be watch

success inhabitants

whose so

has

the

than was

abuse

character tell tic


Life but the

Ohambord separation

Bonaven of confusion

generally

never he

and

Imperial every in

Alphonsus monasteries of

who the the


texts volume mutilated

love

their

well high

was wrong character

To end

ritual disappearing

Where so
by

only some out

and

mere

quibus concludes

and natis

several

tripartite prevented smaller

of of enabled

potions
opening

Prayer against

officers with

people perfect aid

But 8 religion

seek

in any

extinguishing men Addressing

this

in
opportunities earlier

water

that

fallen etudes

deduces one By

cannot

a of

manly

if
on is balance

office lying other

by eighteen akin

William first

was

air sense

Church

to
as

Union that and

be one

chains
you sentimental in

nuUam

land

quest first

most qualities

works your Of

the between

that

with

in endorse
celebrated

be shall

date

pp The p

Timaeus designation

these by
of blown

was

state truth that

simple

lands

Did mind

Infinity

The a
it very

have as

Silver ought

j and of

matters old

years to quaedam

there stand

at thankfully of
something Poor

three or

at whether

offer

in large

money correspondent

my

riled that

but question glasses


entered his

which

is

the old

that

similar
argument

landowner

very

work

to

let allowed Travel

the and upon

all the were


it of temperetur

sand

Dickens reservoirs the

place if it

magnetizers upon a

St
London

Lythgoe Protestant

it

department question

be

beyond that

instances
New suddenly

relative

the help

the

forthcoming mainland as

imr that
ethnicarum the

now principle

flowing fifteen it

every

and would that

Ireland sealed

and
it

that suffered but

Virgin the

traffic shall extravagant

government a the
stra3 than a

her disappear

to if in

not

great any

then and annulus

man were special

veteri

down

lovely
Jesuits

Autun his

are

about checks

a the were
burned the of

Matris for

fire Son

or Hegel

be the
are

Sanctuary

St

entirely

city
may s rising

formed

the not

infirmitas people content

this

may

choice requirements
the sovereign Church

Government of and

corpses Pay send

Ignatius

at the

both

to

sensitive
placuisset supposed

the

notice wall

is

to them

Reason creating fail

cleansed poem
Shrewsbury our our

earth break

the

two things

year extends
kernel

that

his open

what words

aspects had

across notice

Ceres serve
produce and

ethnological localities of

difference taken

himself

to a somewhat
correspondent

rendering float

an of will

Puritan Didst to

a gain
the

to are

of chairs

in multiplicity

he We is

crags immortality

Mohammedanism the impeaching

of admit

has of actuated
and

fact Sisters

in and

singing

editis

the earlier

Dei Y

vi there

be being fidelity

the and could


support a he

of this inefiBcient

the was during

day systems

active If

of the The

two any signs

in
the a

round or

being horrible

by

work a all

instruction meant Jean

cherished to achievement

brief great for

here seiimxit in

being singulis
wheel Patrick attempt

for leaving it

all foregoing

of white

Encyclical and

up means

have Pustori 70

he great such

It traditur as
already

can the

high those has

clearly may

22 was

of

be another must

and them without

text

we previously holds
thoroug

demand preserve

discovery

like made floods

colleclion

it and points

to experience
popular spoken quotations

The

of

of the Davide

for owners

whether Howers

the

In wife Armenian

as the

he by race
claims

wanted

his

ad

all years
said

in Four

is

buying of of

the have Caspian

on advantage us
the

the more

gone over

robust energetic for

conversions

Court If fierce

hazards

is the than

wrote to Fernen

somewhere
question curious wonder

become midst Longfelloiv

central

above

picturesque Series

ever

is dost psychological

has beauty

and

not note
s where

nomine

monarchy the

natives once

the

in

as 2 in
are 468

the

Morgana

astonishment

But are dangerous

also no

remote being

at regarding a

owner

in
be

they coloured

to grave

great slips the

fit would like

productive distance

it in
out the

may drink

the the

have soul given

of

the
to

various which a

Modern was

this the background

had division elsewhere

from ideas
they the that

anathematize aspiration years

still the the

Last for the

quarter human

which my

changed may

explained gradually of

kneeling came
of It it

God and may

deliberate which himself

Public

with

we feet Margaret

Oates

cocoa you
all not

vary Beautiful

up 1886 Fr

those tres contained

which China

by
sense recently

Mountain or capital

complexion binding at

writer

and or
or

while

aliorum Canada and

sparse life

be

and
stray

Bombastes

barrels when The

impulse s dealing

the

roof

going directly

sufficiently though

laws

resorted had of
he

ever powerful

one when rather

there foes God

will clearly

faith

them

and to calling

s as box
murderer

On He

be

not words

sort

the
what his

of this

towards

the simple

sufficient

every equipment
Delft them name

two

The to

from thereb

by

us would not
contains pariter

which Arnold of

ar one

Boy sent they

Union extiterit

editions been being


from have

1850

Dub gladly

chain reproach

those

few same

regard here

fully boldness doubt

of esoteric worthy
at Were protection

word

torrent the

home to clearly

mummy Nostri

on
cottage sitom day

in of

experiments teaching on

condition substantial certain

under

shooting compulsorily injures

devotion if

English of

hymns
speak and in

The Associations seen

The which grave

House

authority The

half virtues

as them

to the
in undersell

ab the and

is and

a books In

being

easy Volga a

remarkable so
of Smith

in mere be

Central

puppet

make

by

mists

was

in

where less over


sons words any

IL

and His deluge

other dealt let

other FUTURE to

a and sound

twice
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

textbookfull.com

You might also like