Command Reference : Operator and Function Reference : Workfile & Informational Functions
  
Workfile & Informational Functions
 
General Information
Element Information
Basic Workfile Functions
Dated Workfile Information
Panel Workfile Functions
The following list summarizes the utility functions that are designed to provide information about the currently active workfile and the EViews environment. These functions are described in greater detail in “Workfile Functions”.
General Information
 
Function
Name
Description
@env(str)
environment variables
returns a string containing the value of the Windows environment variable str.
For example @env(“username”) returns the user-name of the current logged in user. @env(“computername”) returns the name of the computer.
@fileexist(str)
file exist
returns a 0 or 1 depending on whether the filename specified by str exists on disk.
@folderexist(str)
folder exist
returns a binary scalar, equal to 1 if the folder specified by str exists on disk, and 0 otherwise.
@tablenames(str)
table/sheet names
returns a space delimited string containing the names of the table names of a foreign file. str should be the name (and path) of the foreign file, enclosed in quotes. For an Excel file, the names of the Excel sheets will be returned.
@getnextname(str)
get next name
returns a string containing the next available variable name in the workfile, starting with str. e.g. entering “result” will return “result01” unless there is already a RESULT01, in which case it will return “result02”.
@vernum
version number
returns a scalar containing the EViews version number.
@verstr
version string
returns a string containing the EViews version string (e.g. “EViews Enterprise Edition”).
@wdir(str)
directory listing
returns a string list containing a list of all of the files in the directory str.
@wquery(“database”, “search_expression”, “attribute_list”)
database query
returns a string list containing the attribute_list of all objects in database that match the query given by search_expression (see @wquery for details).
Element Information
 
Function
Name
Description
@elem(x,"v")
element
returns the value of a series at an observation or date. The observation or date should be entered in double quotes.
@first(x)
first element
returns the value of the first non-missing value in the series for the current sample.
@ifirst(x)
index of first element
returns the workfile index of the first non-missing value in the series for the current sample.
@ilast(x)
last element
returns the workfile index of the last non-missing value in the series for the current sample.
@last(x)
index of last element
returns the value of the last non-missing value in the series for the current sample.
Basic Workfile Functions
 
Function
Name
Description
@dbname
database name
returns a string containing the current default database.
@ispanel
panel workfile
returns a 0 or 1 depending on whether the workfile is panel structured.
@obsrange
observations in range
returns the number of observations in the workfile range.
@obssmpl
observations in sample
returns the number of observations in the workfile sample.
@pagecount
page count
returns a scalar containing the number of pages in the current workfile.
@pageexist(str)
page exists
returns a 0 or 1 depending on whether the page specified by str exists in the current workfile.
@pagefreq
page frequency
returns a string containing the frequency of the active page.
@pageids
workfile page identifiers
returns a string containing a space delimited list of the id series for the current workfile page.
@pagelist
page names list
returns a space delimited string containing the names of all the pages in the current active workfile.
@pagename
page name
returns a string containing the name of the active page.
@pagesmpl
workfile page sample
returns a string containing the current sample for the active page.
@wfname
workfile name
returns a string containing the current default workfile name.
@wfpath
workfile path
returns a string containing the current default workfile path.
Dated Workfile Information
The following functions return information about each observation in the workfile. They are used to generate new series.
 
Function
Name
Description
@after(arg1)
date is after
creates a dummy variable equal to 1 if the observation is after or on the date given by arg1. arg1 should be enclosed in quotes.
@before(arg1)
date is before
creates a dummy variable equal to 1 if the observation is before the date given by arg1. arg1 should be enclosed in quotes.
@date
date
returns the date value.
@day
day of month
returns the day of the month.
@during(arg1)
date is during
creates a dummy variable equal to 1 if the observation lies between the dates given by the date pair contained in arg1, and 0 otherwise. arg1 should be given in quotes.
@enddate
observations in range
returns the end date of the period of time associated with the observation in the workfile.
@event(d1[,d2 basis])
event proportion
proportion of a one-off event that lies in each observation.(See “Event Function (@event)” for syntax and discussion).
@holiday(h[, b][, flag...]
holiday proportion
proportion of an annual event that lies in each observation. (See “Holiday Functions” for syntax and discussion).
@holidayset(h[, b][, flag...]
holidayset proportion
proportion of an annual events that lies in each observation. (See “Holiday Functions” for syntax and discussion).
@hour
hour
returns the hour of each observation as an integer.
@hourf
hour floating point
returns the hour of each observation as a floating point number (e.g., 9:30 a.m. returns 9.5, and 5:15 p.m. returns 17.25).
@isperiod(x)
period dummy
returns a dummy variable for whether the observation is in the specified period.
@minute
minutes
returns the minute of each observation as an integer.
@month
month
returns the month of an observation.
@quarter
quarter
returns the quarter of an observation.
@seas(x)
seasonal dummy
returns a seasonal dummy variable.
@second
seconds
returns the second of each observation as an integer.
@strdate(x)
string dates
returns a string representing the date for every observation.
@trend([x])
time trend
returns a time trend using the workfile calendar.
@trendc([x])
calendar time trend
returns a time trend where the trend uses calendar time.
@weekday
day of the week
returns the day of the week.
@year
year
returns the year
Panel Workfile Functions
 
Function
Name
Description
@cellid
element
returns the inner dimension identifier index.
@crossid
observations in range
returns the cross-section identifier index.
@obsid
cross-section observation number
returns the observation number within each panel cross section.
@trend
time trend
returns a time trend for each cross-section using the observed dates in the panel.
@trendc
calendar time trend
returns a time trend for each cross-section where the trend uses calendar time.