Skip to Main Content
Applied Econometrics Using the SAS® System
book

Applied Econometrics Using the SAS® System

by Vivek B. Ajmani
June 2009
Intermediate to advanced content levelIntermediate to advanced
328 pages
8h 42m
English
Wiley-Interscience
Content preview from Applied Econometrics Using the SAS® System

Appendix B

BASIC MATRIX OPERATIONS IN PROC IML

B.1 ASSIGNING SCALARS

Scalars can be viewed as 1 × 1 matrices and can be created using Proc IML by using the statement x=scalar_value or x={scalar_value}. As an example, the statements x=14.5 and x={14.5} are the same and both store the value 14.5 in x. We can also store character values as the commands name=’James’ and hello=’Hello World’ illustrate.

The stored values in the variables can easily be determined by using the print command in Proc IML. For example to view the values in the variables x, name, and hello use the command Print x name hello.

B.2 CREATING MATRICES AND VECTORS

As mentioned in Appendix A, it is easy to create matrices and vectors in Proc IML. The command A={24, 3 1} will create the matrix

images

Each row of the matrix is separated by a comma. That is, each row of the above command yields a row vector. For instance, the command A={1 2 3 4} creates the row vector A = [1 2 3 4].

If we separate each entry in the row vector by a comma, we will get a column vector. As an example, the command A={1,2,3,4} creates the column vector

images

These commands can easily be extended to create matrices consisting of character elements. For example, the command A={’a’ ’b’, ’c’ ’d’} will create the matrix

B.3 ELEMENTARY MATRIX OPERATIONS

B.3.a ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Applied Econometrics with SAS

Applied Econometrics with SAS

Barry K. Goodwin, A. Ford Ramsey, Jan Chvosta

Publisher Resources

ISBN: 9781118210321Purchase book