INQUIRE Instruction |
INQUIRE( options ) value1<<p1 value2<<p2
# list of variables (in Regression Format, only with REGRESSORLIST option)
INQUIRE lets your program obtain information, principally about the ranges of series. This is needed if you are writing general procedures and need to adjust the range to analyze based upon the input series.
Parameters
|
value1,value2 |
These are INTEGER variables or INTEGER elements of a VECTOR or RECTANGULAR array which are filled with the information requested. Some options only return one value—you do not need to specify a variable for value2 in such cases. |
|
<<p1,<<p2 |
(Optional) Use these in situations where you want your PROCEDURE to mimic the standard “these default to the defined range of series” behavior of RATS instructions. p1 and p2 should be PROCEDURE parameters or options of type INTEGER. value1 and value2 will take the values of p1 and p2, if explicit values for those are provided. Otherwise, they get the INQUIRE values. See the first example. |
Options (mutually exclusive):
SERIES=series name or number
Sets value1, value2 to the defined range of the series
REGRESSORLIST/[NOREGRESSORLIST]
EQUATION=EQUATION supplying list of variables
MODEL=MODEL supplying list of variables
Use REGRESSORLIST and a supplementary card listing a set of variables in regression format when you want to determine the maximum defined range for a set of variables. value1 and value2 are set to the starting and ending entries of that range. EQUATION is similar, but determines the range based on the variables (both dependent and explanatory) in the EQUATION you supply. MODEL determines the range based upon all variables in all (linear) equations in the MODEL.
SMPL/[NOSMPL]
Returns value1, value2 = start and end range of the current SMPL
SEASONAL/[NOSEASONAL]
This returns as value1 the current calendar seasonal: for instance, 4 for a quarterly CALENDAR, 12 for a monthly CALENDAR.
VALID=dummy series to create [unused]
Used in conjunction with DSERIES, LASTREG, REGRESSORLIST, or SERIES, this creates a 1/0 dummy series, with 1's for entries which the input series or regression is defined, and zeros elsewhere. This can then be used with SMPL options on other instructions to select a sample range.
DSERIES=series stored on a RATS file.
Sets value1 and value2 to the starting and ending entries of the series given the current CALENDAR (not necessarily the range on the file). You must open a RATS file with DEDIT before using this option.
LASTREG/[NOLASTREG]
value1 and value2 are set to the starting and ending entries of the last regression. However, it's simpler to use the %REGSTART() and %REGEND() functions.
MATRIX=matrix name
This returns the dimensions of the indicated matrix. value1 and value2 are set to the number of rows and columns, respectively. However, it's simpler to use the %ROWS(matrix) and %COLS(matrix) functions instead.
Examples
procedure test series start end
type series series
type integer start end
local integer startl endl
inquire(series=series) startl<<start endl<<end
This is similar to the entry code for many of the procedures which we provide with RATS. Let’s look at three possible command lines to execute @TEST.
@test gdp82
@test gdp82 1947:1 2013:4
@test gdp82 1955:1 *
In the first, STARTL and ENDL will be the start and end of the series GDP82. In the second, they will be 1947:1 and 2013:4 and in the third, 1955:1 and the end of GDP82.
inquire(equation=vareqn) rstart rend
This returns in RSTART and REND the range allowed by the variable in VAREQN.
instruments ablogc dlogp dlogpn dlogy treduced
inquire(valid=absample,reglist)
# dlogc{0 1} dlogp dlogpn dlogy
mcov(instruments,lwform=||-1.0,2.0,-1.0||,smpl=absample)
determines the set of entries at which all the series and lags listed in the supplementary card for the INQUIRE are defined, returning that as the dummy series ABSAMPLE.
env ratsdata=modeldat.rat
cal(q) 1960:1
inquire(dseries=gdp) * endgdp
inquire(dseries=unemp) * endunemp
compute dataend=%imin(endgdp,endunemp)
allocate dataend
checks the current length of the series GDP and UNEMP on the file MODELDAT.RAT, and sets DATAEND to the minimum of the two. You can use INQUIRE in this fashion to write a forecasting program, for instance, which requires no modification from month to month except updates of the data file.
Copyright © 2026 Thomas A. Doan