[Gretl-users] dummy variables

Allin Cottrell cottrell at wfu.edu
Mon Nov 16 08:57:55 EST 2009


On Mon, 16 Nov 2009, Data Analytics Corp. wrote:

> I have two question on how to create dummy variables.  Suppose...
>
>    1. I have a time series of annual data, say from 1970 to 2000.  How
>       do I create a dummy for the period 1975-1980 (1 for this period, 0
>       otherwise)?

Ignacio answered that one.

>    2. I have cross-sectional data by states.  How do I create a dummy
>       for the southern region where I know the states in that region?

Basically the same answer, except that the Southern states might
not be contiguous in your dataset, in which case you'd need
something like

series south = (obs==1 || obs==2 || obs==5 ...)

Or, if the dataset contains state labels for the observations,

series south = (obs=="AL" || obs=="SC" || ...)

Allin Cottrell


More information about the Gretl-users mailing list