series Series Declaration
Declare a series object.
The series command creates and optionally initializes a series, or modifies an existing series.
Syntax
series ser_name[=formula]
Examples
series x
creates a series named X filled with NAs.
Once a series is declared, you do not need to include the series keyword prior to entering the formula. The following example generates a series named LOW that takes value 1 if either INC is less than or equal to 5000 or EDU is less than 13, and 0 otherwise.
series low
low = inc<=5000 or edu<13
This example solves for the implicit relation and generates a series named Z which is the double log of Y so that Z=log(log(Y)).
series exp(exp(z)) = y
The command:
series z = (x+y)/2
creates a series named Z which is the average of series X and Y.
series cwage = wage*(hrs>5)
generates a series named CWAGE which is equal to WAGE if HRS exceeds 5, and zero otherwise.
series 10^z = y
generates a series named Z which is the base 10 log of Y.
The commands:
series y_t = y
smpl if y<0
y_t = na
smpl @all
generate a series named Y_T which replaces negative values of Y with NAs.
series z = @movav(x(+2),5)
creates a series named Z which is the centered moving average of the series X with two leads and two lags.
series z = (.5*x(6)+@movsum(x(5),11)+.5*x(-6))/12
generates a series named Z which is the centered moving average of the series X over twelve periods.
genr y = 2+(5-2)*rnd
creates a series named Y which is a random draw from a uniform distribution between 2 and 5.
series y = 3+@sqr(5)*nrnd
generates a series named Y which is a random draw from a normal distribution with mean 3 and variance 5.
Cross-references
There is an extensive set of functions that you may use with series:
A list of functions is presented in “Operator and Function Reference”.
See “Numeric Expressions” for a discussion of rules for forming EViews expressions.