Command Reference : Workfile Functions : Basic Workfile Information
  
Basic Workfile Information
The @obsnum function provides information on observation numbering for the workfile:
@obsnum: returns the observation number of the current observation in the workfile.
The observation number starts at one for the first observation in the workfile, and increments by one for each subsequent observation.
For example:
series idnum = @obsnum
creates a series IDNUM that contains sequential values from one to the number of observations in the workfile.
Other functions return scalar values associated with the workfile and default workfile sample:
@elem(x, "arg"): returns the value of the series x at observation or date arg. If the workfile is undated, arg should be an integer corresponding to the observation ID as given in @obsnum. If the workfile is dated, arg should be a string representation of a date in the workfile. In both cases, the argument must be enclosed in double quotes. Note that @elem is not available in panel structured workfiles.
@ispanel: returns indicator for whether the workfile is panel structured (0 if no workfile in memory).
@obsrange: returns number of observations in the current active workfile range (0 if no workfile in memory).
@obssmpl: returns number of observations in the current active workfile sample (0 if no workfile in memory).
@pagecount: returns the number of pages in the current active workfile (0 if no workfile in memory)
@pageexist: returns a 0 or 1 depending on whether the page specified by str exists in the current workfile.
The following functions return a string value associated with the current workfile:
@pagefreq: returns the frequency of the active page.
@pagename: returns the name of the active page.
@pagelist: returns a space delimited string containing the names of all the pages in the current active workfile.
@pagesmpl: returns the current sample for the active page.
@pageids: returns the id series for the current active page. If the page is a regular dated page, “@date” is returned. If the page is irregular, or structured by an id series, names of the id series are returned. If the page is completely unstructured, empty string is returned. In a panel it returns the cross-section identifiers followed by the date identifier.
@wfname: returns the current default workfile name.
@wfpath: returns the current default workfile path.