RATS 10.1
RATS 10.1

Data Types /

Series workspace

Home Page

← Previous Next →

Series Workspace and Default Length

In any program that uses data series, there is, at any time, a default workspace length. This is used as the default length on any instruction that doesn't have a specific set of series as inputs. By far the most important of these is SET. The workspace length is determined either by an ALLOCATE instruction or by the first instruction which creates a data series. If the first two instructions in a program are

 

cal(q) 1960:1

allocate 2012:4

 

they create a series workspace with a standard length of 212 entries, which is 2012:4 given the quarterly calendar starting in 1960:1. If the program starts with

 

open data tablefc-1.txt

data(format=prn,org=columns) 1 20 y e


the workspace has a default length of 20, and if you start with

 

set u 1 500 = %ran(1.0)


the workspace has a default length of 500. In the last case, if you now do

 

set(first=0.0) xu = xu{1}+u


the SET instruction will also operate over the range 1 to 500.


On a SET, you can always override the default length by using explicit start and end parameters. For instance,
 

compute ndraws=1000000

set beta2 1 ndraws = 0.0


creates a series BETA2 with 1000000 data points regardless of the default workspace length.


Changing the Workspace Length

The only way to change the default workspace length (without resetting the program) is to use a new ALLOCATE instruction. The following rearranges a panel data set which has 346 individuals and 10 years of data, but the original data set has the time series data in separate series for each year. (The series without year numbers are time-invariant). The data are original read into a workspace of length 346, then the ALLOCATE at the end redefines the length as 346 x 10 entries in a panel-dated workspace

 

*

* Baltagi, "Econometric Analysis of Panel Data", 4th ed.

* Example from Section 10.8, pp 229-232

*

open data patentdata.txt

data(format=free,org=columns) 1 346 cusip ardssic scisect logk sumpat $

 logr70 logr71 logr72 logr73 logr74 logr75 logr76 logr77 logr78 logr79 $

 pat70  pat71  pat72  pat73  pat74  pat75  pat76  pat77  pat78  pat79

*

* Rearrange the data into a panel data set

*

pform(input=time) logr

# %slike("logr##")

pform(input=time) patent

# %slike("pat##")

cal(panelobs=%nobs,a) 1970

all %ngroup//%nobs


Copyright © 2025 Thomas A. Doan