@pageinidx |

Indicators for whether a observation in a workfile page is in an index.

Syntax: @pageinidx(x)

x: vector

Return: vector

Returns a vector containing (0,1) boolean values for whether each observation in the current workfile page is specified in x, where x contains the indices of observations.

Examples

wfcreate(wf=qwf) q 2001 2024

vector id1 = @pageidx("2010q2 2010q3 2021q1 2023q4")

vector include = @pageinidx(id1)

creates a workfile containing quarter observations from 2001 to 2024, identifies the index values for four specific dates and then obtains the vector INCLUDE which has the value of 1 for those four dates, and 0 otherwise.

One useful application of this indicator vector is setting the workfile sample. Since ID1 is the same length as the current page, the commands

vector include = @pageinidx(id1)

mtos(include, keep)

smpl if keep=1

set the current workfile sample to include only the four observations specified above.

Cross-references