genr |

Generate series.

This procedure allows you to generate multiple series using the cross-section identifiers in a pool.

Syntax

pool_name.genr(option) ser_name = expression

You may use the cross section identifier “?” in the series name and/or in the expression on the right-hand side.

Options

prompt | Force the dialog to appear from within a program. |

Examples

The commands,

pool pool1

pool1.add 1 2 3

pool1.genr y? = x? - @mean(x?)

are equivalent to generating separate series for each cross-section:

genr y1 = x1 - @mean(x1)

genr y2 = x2 - @mean(x2)

genr y3 = x3 - @mean(x3)

Similarly:

pool pool2

pool2.add us uk can

pool2.genr y_? = log(x_?) - log(x_us)

generates three series Y_US, Y_UK, Y_CAN that are the log differences from X_US. Note that Y_US=0.

It is worth noting that the pool genr command simply loops across the cross-section identifiers, performing the evaluations using the appropriate substitution. Thus, the command,

pool2.genr z = y_?

is equivalent to entering:

genr z = y_us

genr z = y_uk

genr z = y_can

so that upon completion, the ordinary series Z will contain Y_CAN.

Cross-references

See
“Pooled Time Series, Cross-Section Data” for a discussion of the computation of pools, and a description of individual and balanced samples.

See
Series::series for a discussion of the expressions allowed in genr.