Command Reference : Function Reference : Function Reference: P
  
 
@pageidx
Index vector of specific observations.
Syntax: @pageidx(x)
x: vector, svector, string
Return: vector
Returns a vector containing the index values in the current workfile page of the observations specified in x.
If x is a vector, the elements of x should be date numbers.
If x is a svector, the elements of x should be string representations of dates.
If x is a string, it should contain a space delimited list of dates.
Any specified observations that are not in the current page will be ignored.
This function is only available in regular frequency, non-panel workfiles.
Examples
wfcreate(wf=qwf) q 2001 2024
vstring vdates = "2010q2 2010q3 2021q1 2023q4"
svector sdates = @wsplit(vdates)
creates a workfile containing quarterly data from 2001 to 2024, creates a string object containing four specific dates, and creates the corresponding svector with those string values.
Then the commands
vector id1 = @pageidx("2010q2 2010q3 2021q1 2023q4")
vector id2 = @pageidx(vdates)
vector id3 = @pageidx(sdates)
all create four element vectors containing the values {38, 39, 81, 92}.
vector(4) ndates
for !i = 1 to 4
ndates(!i) = @dateval(sdates(!i))
next
vector id4 = @pageidx(ndates)
uses a vector with date numbers to return the same vector.
Cross-references
See “Dates”.
See also @pageinidx, @pagesmplidx, @dateval, and @wsplit.