ENTER Instruction |
ENTER( options ) variables list
#< supp. card > values for the variables
ENTER permits you to define your own supplementary cards for a PROCEDURE. You can also use ENTER to build up a list of unknown length in a VECTOR (though a LIST aggregator is now a better way to handle that). ENTER can be very helpful in writing high-level procedures which mimic other RATS instructions.
In recent versions of RATS, the new regression list functions, such as %RLADDLAG and %RLCONCAT take up part of the role that ENTER used to play.
Parameters
variables list |
ENTER sets the values of the variables you list using the information on the supplementary card. These can be INTEGER, REAL, COMPLEX, LABEL or STRING variables or array elements. You can use any combination of these types.
You can enter a complete array only if it is the only object in the variables list. |
Options
VARYING/[NOVARYING]
ENTRIES=(output) INTEGER for number of entries
You can only use VARYING when you are entering a VECTOR of one of the basic data types. It allows you to input a list of unspecified length, such as a regression supplementary card. If you use VARYING, you can include the option ENTRIES. ENTRIES saves in an INTEGER the number of entries processed.
SEQUENCE=sequence number in LIST sequence
This allows you to use a list defined by LIST and CARDS instructions rather than a supplementary card to provide the input to the ENTER. With SEQUENCE, RATS evaluates the subsequent CARDS instruction using the value supplied by the option as the sequence number in the sequence defined by the LIST instruction.
Supplementary Card
ENTER has a number of uses, and the placement of the supplementary card depends upon how it is being applied:
•If you use ENTER to bring in specific information when the procedure is used (a regressor list, for instance), omit the card from the procedure. When there is no supplementary card immediately after ENTER, RATS expects to see it after the instruction which called the procedure.
•If you use ENTER within the procedure itself to build up a list in a VECTOR, include the supplementary card in the procedure, right after the ENTER.
If you are reading in a complete array, ENTER takes it from a single supplementary card according to the internal arrangement of the array:
•For RECTANGULAR, by columns
•For SYMMETRIC or PACKED, by rows, lower triangle only.
Examples
procedure constrain nconstr r
type integer nconstr
type vector *r
local integer nser nper i
local real value
do i=1,nconstr
enter nser nper value
compute r(i)=value-([series]nser)(nper)
end do i
end
@CONSTRAIN will have NCONSTR supplementary cards, each with two integer values and one real. The first integer should be a series name or number. For example:
@constrain 3 r
# tbill 1999:4 5.6
# tbill 2000:1 5.8
# tbill 2000:2 5.8
You can use ENTER(VARYING) along with regressor list functions to build up a list of regressors, which is particularly useful in writing procedures. The following code, taken from the @VARLAGSELECT procedure, builds a VAR regressor list:
enter(varying) list
compute n=%rows(list)
compute ntotal=n*(lags+1)
* Build the regressor list, starting with the dependent variables:
dim reglist(0)
do i=1,n
compute reglist=%rladdone(reglist,list(i))
end do i
* Now add the lagged variables.
do j=1,lags
do i=1,n
compute reglist=%rladdlag(reglist,list(i),j)
end do i
end do j
Notes
INPUT, READ, COMPUTE and FIXED are superior to ENTER when you have known values. QUERY and MEDIT also can be used to get information from a user.
Copyright © 2025 Thomas A. Doan