Command Reference : String and Date Function Reference
Syntax: @dtoo(str)
Argument: string, str
Return: integer
Date-TO-Observation. Returns the observation number corresponding to the date contained in the string. The observation number is relative to the start of the current workfile range, not the current sample. Observation numbers may be used to select a particular element in a vector that has been converted from a series, provided that NAs are preserved (see stomna).
scalar obnum = @dtoo("1994:01")
vec1(1) = gdp(@dtoo("1955:01")+10)
Suppose that the workfile contains quarterly data. Then the second example places the 1957:02 value of the GDP series in the first element of VEC1.
Note that @dtoo will generate an error if used in a panel structured workfile.
See also @otod.