Alpha
Alpha (alphanumeric) series. An EViews alpha series contains observations on a variable containing string values.
Alpha Declaration
alpha declare alpha series.
frml create alpha series object with a formula for auto-updating.
genr create alpha or numeric series object.
To declare an alpha series, use the keyword alpha, followed by a name, and optionally, by an “=” sign and a valid series expression:
alpha y
alpha x = "initial strings"
If there is no assignment, the series will be initialized to contain empty (blank) values, “”.
Alpha Views
display display table, graph, or spool in object window.
dups duplicates display for observations in the series.
freq one-way contingency table.
label label information for the alpha.
sheet spreadsheet view of the alpha.
Alpha Procs
clearhist clear the contents of the history attribute.
copy creates a copy of the alpha series.
makemap create numeric classification series and valmap from alpha series.
map assign or remove value map setting.
olepush push updates to OLE linked objects in open applications.
setattr set the value of an object attribute.
setindent set the indentation for the alpha series spreadsheet.
setjust set the horizontal justification for all cells in the spreadsheet view of the alpha series.
sort change display order for the alpha series spreadsheet.
Alpha Data Members
@attr("arg") string containing the value of the arg attribute, where the argument is specified as a quoted string.
@description string containing the alpha object’s description (if available).
@detailedtype string describing the object type: “ALPHA”, if an ordinary alpha series, or “LINK”, if defined by link.
@displayname string containing alpha object’s display name. If the Alpha has no display name set, the name is returned.
@first string containing the date or observation number of the first non-blank observation of the alpha. In a panel workfile, the first date at which any cross-section has a non-blank observation is returned.
@firstall returns the same as @first, however in a panel workfile, the first date at which all cross-sections have a non-blank observation is returned.
@hilo string containing the alpha series object’s high-to-low frequency conversion method.
@last string containing the date or observation number of the last non-blank observation of the alpha. In a panel workfile, the last date at which any cross-section has a non-blank observation is returned.
@lastall returns the same as @last, however in a panel workfile, the last date at which all cross-sections have a non-blank observation is returned.
@lohi string containing the alpha series object’s low-to-high frequency conversion method.
@name string containing the alpha object’s name.
@remarks string containing the alpha object’s remarks (if available).
@type string describing the object type: “ALPHA”.
@updatetime string representation of the time and date at which the alpha was last updated.
(i) i-th element of the alpha series from the beginning of the workfile (when used on the left-hand side of an assignment, or when the element appears in a table or string variable assignment).
Alpha Element Functions
@elem(ser, "j") function to access the j-th observation of the alpha series, where j identifies the date or observation.
Alpha Examples
alpha val = "initial string"
initializes an alpha series VAL using a string literal.
If FIRST is an alpha series containing first names, and LAST is an alpha containing last names, then:
alpha name = first + " " + last
creates an alpha series containing the full names.
Declare an alpha series object.
The alpha command creates and optionally initializes an alpha series, or modifies an existing series.
Syntax
alpha ser_name
alpha ser_name=formula
The alpha command should be followed by either the name of a new alpha series, or an explicit or implicit expression for generating the series. If you create a series and do not initialize it, the series will be filled with the blank string “”.
Examples
alpha x = "initial value"
creates a series named X filled with the text “initial value.”
Once an alpha is declared, you need not include the
alpha keyword prior to entering the formula (optionally, you may use
Alpha::genr with a previously created alpha series). The following example generates an alpha series named
VAL that takes value “Low” if either
INC is less than or equal to 5000 or EDU is less than 13, and “High” otherwise:
alpha val
val = @recode(inc<=5000 or edu<13, "High", "Low")
If FIRST and LAST are alpha series containing first and last names, respectively, the commands:
alpha name = first + " " + last
genr name = name + " " + last
create an alpha series containing the full names.
Cross-references
See
“Alpha Series” for additional discussion.
Clear the contents of the history attribute.
Removes the alpha’s history attribute, as shown in the label view of the alpha.
Syntax
alpha_name.clearhist
Examples
a1.clearhist
a1.label
The first line removes the history from the alpha A1, and the second line displays the label view of a1, including the now blank history field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Clear the contents of the remarks attribute.
Removes the alpha’s remarks attribute, as shown in the label view of the alpha.
Syntax
alpha_name.clearremarks
Examples
a1.clearremarks
a1.label
The first line removes the remarks from the alpha object A1, and the second line displays the label view of A1, including the now blank remarks field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Creates a copy of the alpha series.
Creates either a named or unnamed copy of the alpha series.
Syntax
alpha_name.copy
alpha_name.copy dest_name
Examples
a1.copy
creates an unnamed copy of the alpha series A1.
a1.copy a2
creates A2, a copy of the alpha series A1.
Cross-references
Display table, graph, or spool output in the alpha object window.
Display the contents of a table, graph, or spool in the window of the alpha object.
Syntax
alpha_name.display object_name
Examples
alpha1.display tab1
Display the contents of the table TAB1 in the window of the object ALPHA1.
Cross-references
Most often used in constructing an EViews Add-in. See
“Custom Object Output” .
Display name for an alpha object.
Attaches a display name to an alpha object. The display name may be used to label output in tables and graphs in place of the standard alpha object name.
Syntax
alpha_name.displayname display_name
Display names are case-sensitive, and may contain various characters, such as spaces, that are not allowed in alpha object names.
Examples
names.displayname Employee Name
names.label
The first line attaches a display name “Employee Name” to the alpha object NAMES, and the second line displays the label view of NAMES, including its display name.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names. See also
Alpha::label.
Duplicate observations display for observations in the series.
Syntax
series_name.dups(opts)
By default, EViews displays a summary table showing the number of duplicate groups of a given size, but you may use the options to display an alternative view.
Of particular note is that the spreadsheet and individual duplicates displays are interactive - clicking on rows in one will open the display to show the other. Thus, clicking on a duplicate in the spreadsheet view will jump to show all of the observations that share that duplicate. Similarly, clicking on an observation in the shared individual duplicates view will jump to the corresponding observation in the full spreadsheet.
Options
graph | Display observation graph showing duplicates. |
sheet | Display spreadsheet view of duplicates. |
individ | Display first individual duplicates. |
Examples
alpha1.dups
displays the duplicates summary for the alpha series ALPHA1.
alpha1.dups(sheet)
displays a spreadsheet showing highlighted duplicates.
Cross-references
Compute frequency tables.
freq performs a one-way frequency tabulation.
Frequencies are computed for the current sample of observations. Observations with NAs (blank strings) are dropped unless included by option. You may use options to control automatic binning (grouping) of values and the order of the entries of the table.
Syntax
alpha_name.freq(options)
Options
dropna (default) / keepna | [Drop/Keep] NA as a category. |
n, obs, count (default) | Display frequency counts. |
nocount | Do not display frequency counts. |
prompt | Force the dialog to appear from within a program. |
p | Print the table. |
total (default) / nototal | [Display / Do not display] totals. |
pct (default) / nopct | [Display / Do not display] percent frequencies. |
cum (default) / nocum | (Display/Do not) display cumulative frequency counts/percentages. |
sort=arg (default=“lohi”) | Sort order for entries in the frequency table: high data value to low ("hilo"), low data value to high ("lohi" –default), high frequency to low ("freqhilo"), low frequency to high ("freqlohi"). |
prompt | Force the dialog to appear from within a program. |
p | Print the table. |
Examples
names.freq
tabulates the values in NAMES in ascending alphabetical order, displaying counts, percentages, and cumulatives.
names.freq(sort=freqhilo)
tabulates NAMES with the table rows ordered from values with highest frequency to lowest.
Cross-references
See
“One-Way Tabulation” for a discussion of frequency tables.
Declare an alpha series object with a formula for auto-updating, or specify a formula for an existing alpha series.
Syntax
frml alpha_name = alpha_expression
frml alpha_name = @clear
Follow the frml keyword with a name for the alpha series, and an assignment statement. The special keyword “@CLEAR” is used to return the auto-updating series to an alpha series.
Examples
To define an auto-updating alpha series, you must use the frml keyword prior to entering an assignment statement. If FIRST_NAME and LAST_NAME are alpha series, then the formula declaration:
frml full_name = first_name + " " + last_name
creates an auto-updating alpha series FULL_NAME.
You may apply a frml to an existing alpha series. The commands:
alpha state_info
frml state_info = state_name + state_id
makes the previously created alpha series STATE_INFO an auto-updating series containing the alpha series STATE_NAME and STATE_ID. Note that once an alpha series is defined to be auto-updating, it may not be modified directly. Here, you may not edit STATE_INFO, nor may you generate data into the alpha series.
Note that the commands:
alpha state_info
state_info = state_name + state_id
while similar, produce quite different results, since the absence of the frml keyword in the second example means that EViews will generate fixed values in the alpha series instead of defining a formula to generate the alpha series values. In this latter case, the values in the alpha series STATE_INFO are fixed, and may be modified directly.
One particularly useful feature of auto-updating series is the ability to reference series in databases. The command:
frml states = usdata::states
creates an alpha series called STATES that obtains its values from the alpha series STATES in the database USDATA.
To turn off auto-updating for an alpha series, you should use the special expression “@CLEAR” in your frml assignment. The command:
frml id = @clear
sets freezes the contents of the series at the current values.
Cross-references
Generate alpha series.
Syntax
genr alpha_name = expression
Examples
genr full_name = first_name + last_name
creates an alpha series formed by concatenating the alpha series FIRST_NAME and LAST_NAME.
Cross-references
See
Alpha::alpha for a discussion of the expressions allowed in
genr.
Display or change the label view of an alpha series, including the last modified date and display name (if any).
As a procedure, label changes the fields in the alpha series label.
Syntax
alpha_name.label
alpha_name.label(options) text
Options
To modify the label, you should specify one of the following options along with optional text. If there is no text provided, the specified field will be cleared:
c | Clears all text fields in the label. |
d | Sets the description field to text. |
s | Sets the source field to text. |
u | Sets the units field to text. |
r | Appends text to the remarks field as an additional line. |
p | Print the label view. |
Examples
The following lines replace the remarks field of ALPHA1 with “Data from CPS 1988 March File”:
alpha1.label(r)
alpha1.label(r) Data from CPS 1988 March File
To append additional remarks to ALPHA1, and then to print the label view:
alpha1.label(r) Hourly notes
alpha1.label(p)
Cross-references
See
“Labeling Objects” for a discussion of labels.
Create a numeric classification series and valmap from alpha series.
Syntax
alpha_name.makemap(options) ser_name map_name
creates a classification series ser_name and an associated valmap map_name in the workfile. The valmap will automatically be assigned to the series.
Options
prompt | Force the dialog to appear from within a program. |
nosort | Do not alphabetically sort the alpha series values before assigning the map (default is to sort). |
Examples
stateabbrev.makemap statecodes statemap
creates a series STATECODES containing numeric coded values representing the states in STATEABBREV, and an associated valmap STATEMAP.
Cross-references
See
“Alpha Series” for a discussion of alpha series and
“Value Maps” for a discussion of valmaps.
Assign or remove value map to alpha series.
Syntax
alpha_name.map [valmap_name]
If the optional valmap name is provided, the procedure will assign the specified value map to the alpha series. If no name is provided, EViews will remove an existing valmap assignment.
Examples
alpha1.map mymap
assigns the valmap object MYMAP to the alpha series ALPHA1.
alpha2.map
removes an existing valmap assignment from ALPHA2.
Cross-references
See
“Value Maps” for a discussion of valmap objects in EViews.
Push updates to OLE linked objects in open applications.
Syntax
alpha_name.olepush
Cross-references
See
“Object Linking and Embedding (OLE)” for a discussion of using OLE with EViews.
Set the object attribute.
Syntax
alpha_name.setattr(attr) attr_value
Sets the attribute attr to attr_value. Note that quoting the arguments may be required. Once added to an object, the attribute may be extracted using the @attr data member.
Examples
a.setattr(revised) never
String s = a.@attr("revised")
sets the “revised” attribute in the object A to the string “never”, and extracts the attribute into the string object S.
Cross-references
Set the display indentation for cells in an alpha series spreadsheet view.
Syntax
alpha_name.setindent indent_arg
where indent_arg is an indent value specified in 1/5 of a width unit. The width unit is computed from representative characters in the default font for the current spreadsheet (the EViews spreadsheet default font at the time the spreadsheet was created), and corresponds roughly to a single character. Indentation is only relevant for non-center justified cells.
The default indentation setttings are taken from the Global Defaults for spreadsheet views (
“Spreadsheet Data Display”) at the time the spreadsheet was created.
Examples
To set the justification for an alpha series object to 2/5 of a width unit:
alpha1.setindent 2
Cross-references
See
Alpha::setjust for details on setting spreadsheet justification.
Set the horizontal justification for all cells in the spreadsheet view of the alpha series.
Syntax
alpha_name.setjust just_arg
where
format_arg may be set to left, center, right, or auto (strings are left-justified and numbers are right-justified). Default display settings can be set in General Options; see
“Spreadsheet Data Display”.
Examples
a1.setjust left
left-justifies the cells in the spreadsheet view of the alpha series A1.
Cross-references
See also
Alpha::setindent for details on setting spreadsheet indentation.
Spreadsheet view of an alpha series object.
Syntax
alpha_name.sheet(options)
Options
w | Wide. In a panel this will switch to the unstacked form of the panel (dates along the side, cross-sections along the top). |
t | Transpose. |
a | All observations (ignore sample). |
nl | Do not display labels. |
p | Print the spreadsheet view. |
Examples
a1.sheet
displays the spreadsheet view of the alpha series A1.
a1.sheet(t)
displays the observations in A1 in the current sample in a wide spreadsheet.
a1.sheet(nl)
shows the series without labels.
a1.sheet(a)
shows all of the observations in the workfile.
Cross-references
See
“Alpha Series” for a discussion of the spreadsheet view of alpha series.
Change display order for an alpha series spreadsheet.
The sort command changes the sort order settings for spreadsheet display of the alpha series.
Syntax
alpha_name.sort([opt])
By default, EViews will sort the alpha series alphabetically. For purposes of sorting, NAs are considered to be smaller than any other value.
You may modify the default sort order by providing a sort option. If you provide the integer “0”, or the keyword “obs”, EViews will sort using the original workfile observation order. To sort in descending order, simply include the minus sign (“‑”).
Examples
a1.sort
changes the display order for the alpha series A1 so that spreadsheet rows are ordered alphabetically.
a1.sort(-)
sorts in descending order.
a1.sort(obs)
returns the display order for alpha series A1 to the original (by observation).
Cross-references
See
“Spreadsheet” for additional discussion.