Command Reference : String and Date Function Reference
  
 
@dtoo
Date-to-(workfile) observation.
Syntax: @dtoo(str)
str: string
Return: integer
Returns the observation number corresponding to the workfile date contained in the string. The observation number is relative to the start of the current workfile range, not the current sample.
Note that EViews will use the global default settings for the Month/Day order in dates to determine the ordering of days and months in the string.
@dtoo will generate an error if used in a panel structured workfile.
Examples
Suppose that the workfile contains quarterly data from 1990q1 to 2020q4. Consider the commands
scalar obsnum = @dtoo("1994m01")
scalar gdpval1 = gdp(obsnum + 10)
scalar gdpval2 = gdp(@dtoo("1994m01") + 10)
The first line returns 17, the observation in the workfile corresponding to 1990q1, and the latter two find the value of GDP in 1996q3. Note that since we are assigning the value to a scalar on the left, the argument in GDP is interpreted as an element, not a lag.
The command
series dser = @dtoo("12/1/1999")
fills DSER with the observation number corresponding to “12/1/1999” for each observation in the workfile sample, where the months and days are interpreted using the global settings.
If the alpha series ASER contains dates,
series dser = @dtoo(aser)
fills DSER with the observation number corresponding to the string dates in ASER for each observation in the workfile sample.
If AVEC is an svector, the command
vector dvec = @dtoo(avec)
fills DVEC with the observation numbers associated with the strings in AVEC.
Cross-references
See also @otod.