RATS 10.1
RATS 10.1

CLEAR( options )  list of series

CLEAR resets or creates one or more series, setting all of their entries to the missing value code (%NA) or to zero. This provides an easy way to create or initialize series, and to prevent old data from being included in statistical analyses later on.

 

CLEAR can be very helpful when you want to set a new series in an unconventional way, such as with COMPUTE instructions. You cannot refer to particular entries of a series in an expression until you’ve created the series and defined it over a range which includes those entries. CLEAR provides a convenient way of doing this.

Parameters

list of series

The list of the series you want to clear. You can list an array of series to initialize all the series in the array. Use the ALL option to clear all existing series in memory
 

If you include a new series name on the list, that series will be created.

Options

ALL/[NOALL]

If you use ALL, all current series are cleared


 

ZEROS/[NOZEROS]

Use ZEROS if you want to set the values of the series to zero rather than to the missing value code.


 

LENGTH=number of entries [standard workspace length]

Use this to initialize the series over the specified number of entries, rather than through the default ending period.

Examples

clear x y z

 

Creates (if necessary) and NA's out the elements of X, Y and Z.


 

dec vec[series] simul(4)

clear(length=%regend()+12) simul

 

This creates a VECTOR of SERIES called SIMUL that will be used to hold some out-of-sample simulations. SIMUL is initialized out to 12 periods past the end of the most recent regression. This will allow elements of SIMUL to be set using COMPUTE instructions in a later loop.


Copyright © 2025 Thomas A. Doan