MAKE Instruction |
MAKE( options ) array start end
# list of variables (in Regression Format)
MAKE creates an array from the entries of data series. You can use lags and leads in the series list on the supplementary card.
Parameters
array |
RECTANGULAR array to set |
start, end |
range of entries to transfer. By default, the maximum range over which all the variables are defined. |
There are two extra parameters still supported, but not recommended. See "Older Syntax" below.
Description
MAKE creates the array from entries start to end of the listed series. It will automatically create and dimension the array. By default, each column represents a different variable and each row represents an observation in the array. This is the standard arrangement for an \(\bf{X}\) array in \(\bf{y}=\bf{X}\beta\). You can use the TRANSPOSE option to get \({\bf{X'}}\).
Options
EQUATION=equation supplying variables [unused]
LASTREG/[NOLASTREG]
DEPVAR/[NODEPVAR]
With EQUATION, MAKE uses the explanatory variables from the equation as its list of variables. LASTREG uses the explanatory variables from the last regression (or similar instruction). If you include the DEPVAR option, the dependent variable is also included (as the final column). If you include either of these options, omit the supplementary card.
SMPL=Standard SMPL option [unused]
Includes only entries for which the series or formula returns a non-zero or “true” value. The created matrix is compressed to include only the good rows, so there may no longer be a one-to-one correspondence between matrix rows and entries.
PANEL/[NOPANEL]
You can use this to split one or more panel series into a T×(NK) array, where T is the number of periods per individual, N is the number of individuals, and K is the number of series.
MULT=series by which to multiply observations [unused]
SCALE=real value by which matrix is multiplied [unused]
SPREAD=series for weighted least squares, divides rows by square root [unused]
These three options are mutually exclusive.
•With MULT, MAKE multiplies each observation in the matrix by the corresponding entry from the series.
•With SPREAD, it divides each observation in the matrix by the square root of the entry of the spread series. SPREAD has the same basic function as it does for LINREG.
•With SCALE, it multiplies all entries by the single value.
TRANSPOSE/[NOTRANSPOSE]
Use TRANSPOSE if you want the transpose of the X array—each column is an entry and each row a variable. If you want to use the instruction OVERLAY to isolate a subset of the entries, you need to use TRANS.
ENTRIES=number of entries to use from supplementary card [all]
Variables Defined
%NOBS |
Number of observations (INTEGER) |
%NVAR |
Number of variables (INTEGER) |
Examples
This takes the matrix of explanatory variables from the previous regression and creates the matrix X from them. That is used to compute the residual projection matrix:\({\bf{I - X(X'X}}{{\bf{)}}^{{\bf{ - 1}}}}{\bf{X'}}\)
make(lastreg) x %regstart() %regend()
compute m=%identity(%nobs)-x*inv(tr(x)*x)*tr(x)
This does a least squares regression using matrix instructions. We include the SMPL option because each MAKE, on its own, might determine a different default range.
inquire(regressorlist,valid=common) n1 n2
# constant x1 x2 x3 y1
make(smpl=common) x n1 n2
# constant x1 x2 x3
make(smpl=common) y n1 n2
# y1
compute [vector] b=inv(tr(x)*x)*(tr(x)*y)
This creates a T×N matrix UT from the residuals series %RESIDS where T is the number of observations per individual in the panel set and N is the number of individuals.
make(panel) ut
# %resids
compute tdim=%rows(ut),ndim=%cols(ut)
“Unmaking” a Matrix
Use SET or a sequence of SET instructions to set series equal to the rows (or columns) of matrices. For example,
set x2 1 100 = a(t,1)
sets X2 equal to the first 100 entries of column 1 of A. Remember, however, that the T subscript runs over the start to end range on SET, which is not necessarily 1,...,dimension. The following (trivial) example shows how to fix the subscript in the SET to keep the output series aligned with the input. (XX will be the same as X).
make r 1948:1 2013:12
# constant x
set xx 1948:1 2013:12 = r(t-(1948:1-1),2)
If the size of the matrix can change from one use to another, you should “unmake” into a VECTOR of SERIES. For instance, the following creates a vector of NCOLS series from the columns of R.
compute ncols=%cols(r)
dec vect[series] columns(ncols)
do i=1,ncols
set columns(i) 1 %rows(r) = r(t,i)
end do i
Missing Values
If any series has a missing value at an entry, MAKE drops that entry from the constructed array. If you are using MAKE to create several arrays which must have identical sets of entries, use a common SMPL to deal with missing values.
MAKE( options ) array start end numobs numvars
# list of variables (in Regression Format)
Deprecated Parameters
numobs |
(output) INTEGER for number of observations (just use %NOBS variable instead) |
numvars |
(output) INTEGER for number of variables (just use %NVAR variable instead) |
Copyright © 2025 Thomas A. Doan