DUMMY

Options    Examples

DUMMY creates a set of zero-one variables which correspond to the different values taken by an input series. The number of dummy variables created is equal to the number of unique values of the input series (unless EXCLUDE is specified).

DUMMY (EXCLUDE, PREFIX=name) series [listname or list of names];

Usage

DUMMY followed by the name of a series will cause the variables NAME1, NAME2, etc. to be created, where NAME is the name of the series. To use another name as the prefix, include the PREFIX= option. If no input series is supplied and FREQ Q or FREQ M is in effect, Quarterly or Monthly dummies will be created, with the names Q1-Q4 or M1-M12. If a list of series is supplied, the dummies will be given the names in the list; be sure there are as many names as there are values of the variable.

Since the number of dummies created is usually equal to the number of unique values taken by the input series, care should be taken that the series used has a limited number of values. When a "continuous" rather than "discrete" variable is used for input, the number of dummies created could be equal to the number of observations, and storage allocation problems are likely to be the result.

It is well known that a complete set of dummy variables will be collinear with the constant term (intercept) in a linear regression. If you wish to use the dummies together with a constant in this way, you can create a set with one of the variables deleted by using the EXCLUDE option. In this case the number of variables created will be equal to the number of unique values taken by the input series less one.

Output

The set of dummy variables is stored in data storage, and the listname (if one was specified) is defined as the variable names for the set of dummies.

Options

EXCLUDE/NOEXCLUDE excludes the last dummy variable from the list. This option is useful if the list will be used in regressions with a constant term (to prevent multicollinearity).

PREFIX= Prefix for naming the dummy variables. The default prefix is the name of the input series.

Examples

FREQ Q; SMPL 75:1 85:4 ;

DUMMY;

creates Q1,Q2,Q3,Q4 (quarterly dummies). The series created have the following values:

Obs

Q1

Q2

Q3

Q4

75:1

1

0

0

0

75:2

0

1

0

0

75:3

0

0

1

0

75:4

0

0

0

1

76:1

1

0

0

0

76:2

0

1

0

0

and so forth.

FREQ M; SMPL 75:1 84:12 ;

DUMMY(EXCLUDE);

creates M1-M11 (monthly dummies with M12 excluded).

The next example creates a list of dummies from a variable, SIZE, which takes on 3 values: 0, 2, and 3.5.

DUMMY SIZE SDLIST;

This is equivalent to the following statements:

SIZE1 = SIZE = 0;

SIZE2 = SIZE = 2;

SIZE3 = SIZE = 3.5;

LIST SDLIST SIZE1-SIZE3;

The next example creates a set of year dummies for panel data, assuming you have a variable YEAR which takes on values from 72 to 91:

DUMMY YEAR YEAR72-YEAR91 ;

This command creates 20 dummy variables: YEAR72, YEAR73, YEAR74, and so forth.

To create individual dummies for balanced data, using TREND and INT(), see the example under AR1.