RATS 10.1
RATS 10.1

Instructions /

ALLOCATE Instruction

Home Page

← Previous Next →

ALLOCATE length

or

ALLOCATE series length


Use ALLOCATE to set the standard workspace length for your program. For dated data, this is usually set using a date specifier—to do that you must use a CALENDAR instruction before your ALLOCATE instruction to specify the frequency and starting date of your data.


 

The ALLOCATE instruction is now optional. If you prefer, you can omit the ALLOCATE and set the workspace length using the start and end parameters on your first DATA or SET instruction.


 

If you use ALLOCATE, you will usually use the first of the two forms. The second form is generally seen only in programs written for much older versions.

Wizard

The Data Wizards on the Data/Graphics menu determine the appropriate ALLOCATE instruction when the data are read from a single file.

Parameters

length

standard workspace length (not a binding restraint)

series

If you use the second form, this is the number of series to create at the start. We don't recommend this for new programs.

Pre-Allocating Series

If you use the second form, ALLOCATE will create series numbers 1 to series. Any series created later by other instructions will be numbered series+1 and above. These numbered series can be helpful when working with large, well-structured data sets. However, many of these cases are more easily handled using VECTORS of SERIES.


 

You may sometimes see an ALLOCATE which has two parameters giving (apparently) a start and end date for the workspace. This is not correct: the first parameter will get interpreted as the value of series. This error is usually harmless since if the original writer didn't intend to use pre-allocated series, the program will work fine ignoring them

Variables Defined

%X

RECTANGULAR array (dimensions length x series) that contains a copy of the data for series numbers 1 to series

Examples

Monthly data, starting Jan 1959, ending April 2006.


cal(m) 1959:1

allocate 2006:4

 

 

Undated data with 20 observations.

 

compute nbonds=20

all nbonds



 

Daily data, starting Jan 2, 1986, ending Dec 31 1991.

 

cal(d) 1986:1:2

all 1991:12:31



 

Panel data with 7 observations per individual, 90 individuals, data within each individual annual starting 1981.


cal(panelobs=7,a) 1981

all 90//1987:1

 


Copyright © 2025 Thomas A. Doan