When using stata for regression, tool variables and a large number of dummy variables are used.

For example, there is a string of year data.

Id year

00 1 200 1

0 10 2002

100 2003

1 10 2004

1 1 1 2005

Input command

Tab year, gen(dummy_year)

This will automatically generate five dummy variables from 200 1 to 2005.

Regression command

Register y x virtual *

Dummy* is equivalent to five dummy variables from 200 1 to 2005, and the reg command will automatically eliminate one to ensure that there is no complete * * * linearity problem.