вход по аккаунту



код для вставки
“Anyone who expects a source of power from the transformation of the atom is talking moonshine.”
Ernest Rutherford (1871 – 1937)
First man to split the atom
This chapter describes SHAZAM development using SHAZAM Professional Edition.
SHAZAM Professional Edition is available for computers running Microsoft Windows
95/98/ME/2000/XP and NT 4.0. This edition of SHAZAM provides many additional
features including Wizard based command construction and execution, command, data,
matrix, and plot editors, an Advanced Data Connector (ADC), online help, and a project
viewer along with a number of other features not available in previous versions. In
particular the Professional Edition provides:
An easy to use Integrated Development Environment (IDE) designed to make
econometrics easier to perform.
SHAZAM Wizards for the immediate execution of SHAZAM procedures or the
construction and editing of command statements using a mouse.
A Project Viewer - all components used or developed with SHAZAM are kept
together for easy viewing, editing and modification. Datasets in the project can
be set to auto load when programs are executed.
An advanced Command Editor – Providing 3 different ways of executing
commands – by batch, by stepping through line by line or interactively as
commands are typed. Syntax coloring is used as a visual aid ensuring the correct
commands are entered.
A Data Editor – Create, edit or generate new variables visually in an easy to use
spreadsheet style grid. Open and edit a number of common data formats such as
space and comma delimited data, or Microsoft Excel spreadsheets directly into
the Data Editor. This grid supports the viewing of very large datasets (limited
only by system memory).
Advanced Data Connector (ADC) – Used to import data into SHAZAM. The
Professional Edition comes with drivers available for most common data formats
such as Excel, Access, FoxPro, dBASE and Paradox. Connecting to suitable large
Database Management Systems (DBMS) such as SQL Server, Oracle, Sybase or
Informix can also be done across the LAN, WAN or the Internet. Additional or
updated data source drivers are available from Microsoft or the data provider.
An integrated Graph Editor and Viewer - Use the powerful GNUPLOT to create
graphs either programmatically or using the Graph Wizard and then edit graph
features using the graph properties dialog.
Online Help - HTML help, sample data, command files and a command
Accessing the Demonstration Project
SHAZAM Professional Edition comes with a Demonstration Project, which helps explain
some of the main features of this edition. The �Multiple Window’ demo can be found
under the �Demos’ section of the �Help’ menu. Online help will appear providing
instructions on how to use the demonstration project.
SHAZAM Professional Edition introduces a new concept to the way SHAZAM may be
used known as a �Project’.
Figure 1: The Project Viewer Displaying the Demo Project
Projects bring together command files, output files, graphs and data used in analysis; along
with data produced from analysis. Items added to projects are displayed in the project
viewer and may be opened by simply double clicking on them. Projects allow SHAZAM to
coordinate the items used in analysis together. Using the �Project Menu’ it is possible to
create, open, save or export projects. The project file (*.shp) contains links to each of the
files added to the project, as well as information used internally by SHAZAM about each
item. Changes to the project do not in any way affect the files themselves i.e. deleting a file
from a project does not delete it from the disk.
Using a project is optional however once items are added to a project a number of useful
additional features become available. In particular the following items are worthy of note:
Data files created or imported into SHAZAM may be marked as being for
�Autoload’. A data file marked in this way appears in the project viewer in the
folder marked �Data’ with a red dot on its icon (see Fig 1 above). If a command
file is executed using the command editor, the data is automatically read into
SHAZAM removing the need for READ statements.
Data files created by SHAZAM using the WRITE statement appear in the project
viewer the instant they are created. Due to the multithreaded nature of this
edition, graphs may be viewed or modified while a command file is still
Graphs may be edited and many of their features modified using the �Properties’
dialog found under the �Graph’ menu. This feature is only enabled once a graph
has been added to a project. N.B. The graph added to the project is a copy so that
changes made to the graph are not affected should a command file be rerun.
Open items or disk files may be added to the project using the two �Add Item to Project’
options on the �Project’ menu or the �Add to Project’ button on the toolbar. Selecting any
item and pressing the delete key will delete it from a project.
Configuring Datasets for Automatic Input
To select or deselect items to be automatically read into SHAZAM use the �Autoload’
option on the �Project’ menu. It is important not to set �Autoload’ on two different datasets
containing variables with the same name, as the latter variable will be used in preference
over the former.
Exporting Projects to a New Location
The project file (*.shp) contains links to files located on a local hard drive or on a network
location. Should it be desired that all items in the project be placed in a single location e.g.
a common directory on a hard drive, network or on a floppy disk the �Export Project…’
option on the �Project’ menu may be used. SHAZAM will analyze all the contents of a
project and move the project file and the project items to the new location updating all
necessary references and settings. Copying project contents manually without using this
feature may lead to referential integrity problems and is not recommended.
Multiple Window Mode
The default configuration for this edition is called �Multiple Window Mode’ and this mode
makes best use of the features in the Professional Edition. The principal difference between
this mode and �Single Window Mode’ is that commands and the output resulting from
executing those commands are contained in separate windows. This provides the user a
number of useful features some of which include:
Multiple command files may be opened and executed. Output produced from
the execution of each command file is placed in separate windows.
Separation of commands from output allowing easier debugging.
Use of the SHAZAM command editor.
Three ways of executing commands:
1. By Batch - the entire command file is executed at once. Pressing the �Run’
button or F5 on the keyboard executes the currently active window.
2. Interactively (�Talk Mode’) – As enter is pressed the current command is
executed. If the end of the file is reached, new commands may be typed and
are executed when the enter key is pressed.
3. Stepping through – Commands may be executed line by line or in groups.
Syntax coloring of commands and options and multiple level Undo/Redo
Automatic data loading options.
The ability to halt executing commands using the �Stop’ button.
Single Window Mode
This mode may be set using the �Single Window Mode’ option under the �Window’ menu.
In this mode commands and the output from those commands appear in the same window
in a manner similar to the interactive mode of other variants of SHAZAM, such as
SHAZAME (the DOS version).
This mode is similar to being in �Talk’ state of Multiple Window Mode. Pressing enter after
a command is typed immediately executes the command but instead of output appearing
in a separate window, as in the talk state of Multiple Window Mode, the output appears
below the commands within the same window.
Note that data files may be read in using the READ or FILE statements however the data
editor may still be used for creating, editing and saving datasets in a SHAZAM readable
format. The �Load’ button on the data editor can be used to load any dataset open in a data
editor window. Note that a Single Window Mode session cannot be continued the next
time SHAZAM is run, all commands will need to be retyped in sequence.
SHAZAM Professional Edition contains a class of window useful for the creation and
editing of SHAZAM commands known as the Command Editor. Command editor
windows are available only in Multiple Window mode and support command recognition,
syntax coloring, multiple level undo/redo and allow the easy execution of SHAZAM
commands. SHAZAM Wizards may also be used to aid in the construction and editing of
SHAZAM commands.
Figure 2 shows an example of window layout in Multiple Window Mode with a Command
Editor foremost. The buttons �Run’ and �Stop’ control batch execution by executing the
entire command file. Pressing the �Run’ button closes all non-project plots and clears all
output in the associated output window. If there is no output window associated with an
input window, a new one is created. More than one command file may be opened or
created in SHAZAM; separate output windows for each are created the first time they are
The �Talk’ button ( ) may be toggled on or off. In the on state (button appears depressed),
pressing enter executes the line the cursor is on and moves the cursor to the next line. Once
the last line has been reached pressing enter creates a new line. Subsequent typed lines are
executed as the enter key is pressed.
Figure 2: Command Editor in Multiple Window Mode
The next 3 buttons on the toolbar in Figure 2 (
) are for stepping through the
command file. Pressing the first button steps line by line, the second button steps to the
current cursor position and the third button steps over (without executing) the commands
between the current line and the line the cursor is on.
SHAZAM Professional Edition uses a message bar that displays all errors and warnings to
users at the bottom of the screen. Clicking on an error or warning messages jumps to the
line in the output file containing the error or warning message.
This version of SHAZAM includes extensive mechanisms for data handling and these can
be found under the 'Data' menu. In particular using the Advanced Data Connector (ADC)
it is possible to connect to most data providers either locally, on a LAN or across the
The principal mechanism for editing and manipulating datasets or matrices is the data
editor. Using this editor the input of data for analysis by SHAZAM is made considerably
simpler. For example, in all other versions of SHAZAM it is necessary to use the
commands READ, SAMPLE, SORT and GENR for all data manipulation. In many
circumstances the features in this edition provide an easier alternative to using these
Datasets or matrices saved in the data editor are in SHAZAM readable format and those
added to a project may be set for automatic input when commands are read in using the
command editor. See the item �Configuring Datasets for Automatic Input’ in the �Using a
Project’ section. Alternatively pressing the �Load’ button on the data editor immediately
loads the data displayed into SHAZAM memory and can then be used with commands or
with the SHAZAM Wizards.
Datasets may be edited using in-cell editing and variables may be easily generated using
the GENR button on the data editor toolbar. The data editor supports variable creation and
deletion, row, column and cell insertion and deletion similar to spreadsheet style data
grids. Using the �Open’ option on the �File’ menu SHAZAM datasets, space or comma
delimited datasets and Microsoft Excel spreadsheets can be opened directly into the data
editor. Most other datasets can be connected to using the Advanced Data Connector.
Figure 3: Data Editor Showing the Generate Variable Dialog
N.B. Use of the WRITE command automatically adds the file to the current project.
The Advanced Data Connector and Universal Data Access
This version incorporates a feature known as the Advanced Data Connector. This
connector provides universal data access mechanisms using Microsoft Active Data
Objects (ADO) to connect to all Local Machine, Network and Internet databases. A default
set of drivers for a number of common data sources are installed with this version.
The Advanced Data Connector in SHAZAM contains two components. The Microsoft
Data Link and the Preview Window. The Microsoft Data Link is used to make the data
connection string. This string is then used by SHAZAM as the basis for making the data
connection and communicating with the data provider. A successful connection displays
the data preview window (Fig. 5), used to display the data contained in the data source and
is comprised of two panels – a SQL panel and a results grid.
Figure 4: Using the Microsoft Data Link to Connect to a Dataset
Default connectors installed include:
OLE DB Providers for:
Microsoft Access (Jet 3.51, 4.0)
Microsoft FoxPro
Microsoft SQL Server
OLAP and Index Services
OLE DB Providers for ODBC drivers:
Microsoft Excel
Microsoft FoxPro
Microsoft Access
Other drivers may be obtained and installed for most databases available today and
additional drivers can be obtained from Microsoft or the database provider. Please consult
the installation instructions provided with those drivers. SHAZAM does not provide
drivers for data sources other than the ones supplied with the version of Microsoft Data
Access Components (MDAC) required for this version of SHAZAM.
Once a data source has been successfully connected to, the desired table is displayed in the
preview window. A SHAZAM dataset may be easily created from the data displayed in
the lower panel of the preview window by clicking the �Import Data’ button on the
preview window. Before the data in the results grid may be used it must be imported in
this way.
For example, to connect to a local machine dataset such as an Excel, dBASE, or FoxPro file
select �Connect’ under the �Advanced Data Connector’ section of the �Data’ menu. Once
the Datalink has appeared select �Microsoft OLE DB Provider for ODBC drivers’ and click
the �Next’ button. In section 1, select �Build Connection String’ and press the �Build
button’. On the Machine Data Source Tab select the data type as appropriate and follow
the instructions to complete the data connection1.
If the desired data type is not listed on the Machine Data Source Tab press the �New’ button and a wizard
will appear listing all the ODBC drivers installed on the computer. When the ODBC Setup dialog appears
enter a general name e.g. �Microsoft Excel Files’ and do not select the workbook or file at this stage. This will
ensure that the file �Open’ dialog is presented when the data type is selected in future.
Once a successful connection to a data source has been made and the table to view selected,
the entire table contents are presented in a preview window. This window is separated
into two panels and supports Structured Query Language (SQL) as a method of
communicating requests to the data source. The lower panel presents the data results of
the current query. By default all the data contained in the current table is displayed but
this can be modified. See the section below titled �A Quick Guide to Structured Query
Language (SQL) SELECT Statements’ to learn how to programmatically specify commands to
limit the data returned from the data source.
Further instructions on using the Microsoft Data Link can be found with the online help of
SHAZAM Professional Edition, which contains examples, and further information
demonstrating how to connect to various data providers.
A Quick Guide to Structured Query Language (SQL) SELECT Statements
Structured Query Language (SQL) is a very powerful and standardized language used
worldwide for communicating with data providers. The statements are easy to understand
and they give users an enormous ability to extract data based on specified criteria. In very
large datasets or where data grouping or complicated requirements for selecting data are
needed, SQL is often the best method for doing this.
Using the Advanced Data Connector does not require any knowledge of SQL. By default
SHAZAM creates and displays the necessary SQL statements needed to select all data from
the selected data table. SHAZAM supports the use of SQL to communicate with both
relational (such as Microsoft SQL Server and Oracle) and non-relational databases (such as
Microsoft Excel, Paradox or even text) and they may be used to further customize data
To retrieve data from a database the SELECT statement is used. The basic form for a select
statement is:
SELECT variable1, variable2, variable3… FROM tablename WHERE condition1
e.g. If a connection had been established to a database containing a table called �Address’ with
variables (fields) called � id’, �Name’, �PhoneNumber’ and �Province’ then a statement:
SELECT Name, PhoneNumber FROM Address WHERE Province=’BC’
would retrieve only the variables titled �Name’ and �PhoneNumber’ for all observations
with Province value of �BC’. Note that referencing text data requires single quotes.
e.g. To count the items that meet a particular criteria then one might use:
SELECT COUNT(Name) MyCount FROM Address WHERE Province=’BC’
SQL becomes extremely useful when working with relational databases and complex
(sometimes nested) statements can be written to gather data across a number of tables
based on specific criteria.
e.g. To retrieve student records from a database with two tables called �Address’ and
�Students’ a statement such as:
SELECT Name, PhoneNumber FROM Address WHERE Province=’BC’ AND id IN
(SELECT id FROM Students WHERE EnrolYear=2000)
would further refine the result set in the first example to return only those observations (or
records) with an id containing an EnrolYear of 2000 contained in another table.
Figure 5: Custom SQL Statement Executed in the Preview Window
In the example in Fig 5, a query selects the quarter hour average speeds of vehicular traffic
for the 1st quarter hour on a Monday morning from a dataset of approximately 20,000 3minute readings taken over a 4-month period on the London M25 ring road.
N.B. The exact format of the SELECT statement differs slightly depending on the driver
used. For example when communicating with Microsoft Excel through the Microsoft
ODBC driver it is necessary to place square brackets around each database entity (variable
or table name). For databases like SQL Server or Oracle these brackets are not needed.
SHAZAM presents the correct default statement when connecting to each data source so
for most situations these differences should present little difficulty.
See the online users guide for more examples using the ADC with various data providers.
Note on Accessing SQL Server Across the Internet
The Advanced Data connector allows connections to databases that support TCP/IP as a
communication protocol. Microsoft SQL Server (version 7.0 or later) and Oracle are
examples of databases that support this capability so data may be accessed using the
Advanced Data Connector and an active Internet connection.
Microsoft SQL Server uses a protocol called �Named Pipes’ for communication between
clients (like SHAZAM) and the SQL server engine on a LAN and this is the default setting.
Using the utility �cliconfg.exe’ in the SHAZAM directory allows the changing of this
communication protocol to TCP/IP. This is required if attempting to use the Advanced
Data Connector to communicate with Microsoft SQL Server across the Internet.
Details about the programmatic creation of graphs using the GNUPlot utility can be found
in the SHAZAM Users Manual. GNUPlot is an open source graphics utility that produces
high definition, publication quality, 2D and 3D graphs.
SHAZAM Professional Edition makes the handling of these graphs considerably simpler
than other versions of SHAZAM. Graphs created programmatically with this edition are
dynamically loaded into SHAZAM as they are created. Graphs may be printed, copied or
saved easily using options on the toolbar or �Graph’ menu. Conversion from the gnu
format to Graphics Interchange (GIF) and bitmap (BMP) graphics formats may also be
performed using the �Save As…’ option on the �File’ menu or simply by right clicking on
the graph.
Figure 6: The SHAZAM Graph Editor
Creating 2D and 3D Graphs using the Graph Wizard
SHAZAM Professional Edition also provides a Graph Wizard to allow the creation of
common 2D and 3D graphs from the Data Editor. Using this easy to follow wizard it is
possible to construct dot, line, point, impulse or box plots and modify their features using
the properties dialog, once they are added to the current project. To access the wizard,
open a dataset inside the Data Editor and choose �Create New Graph’ on the �Graph’ menu.
Modifying Graph Features
Adding a graph to the current project saves the graph with a chosen name and allows it to
be modified using the Graph Properties dialog. Note that only by adding a graph to a
Project can prevent it being closed the next time a command file is executed. Because
graphs are made programmatically, rerunning a command file from the Command Editor
proceeds by first closing all plots not contained in a Project. Should it be desired to retain
the graph, ensure it is added to the current project.
Figure 7: Modifying Graph Properties
This dialog can only be activated once a graph has an entry in the Project Viewer in the
�Graph’ folder. Changes are made and saved instantly. Note that options grayed out are
not available for the current graph; some options apply only to specific graph types.
Default font and graph sizes can also be modified using the �Options’ dialog found on the
�Project’ menu. Buttons for viewing and editing graph data and the GNU source code by
hand are also available.
SHAZAM wizards allow commands to be created or procedures to be executed
immediately by selecting variables and procedure options using a mouse. Wizards may be
used either to run a sequence(s) of procedures interactively, or to create and edit SHAZAM
commands in a command editor document. Wizards are especially useful when learning
SHAZAM as they aid in prompting which options are available with each procedure.
To run a wizard click the 'Wizards' button on the main toolbar and the Wizard launcher
will appear.
Figure 8: Selecting a Procedure Wizard
Selecting Generalized Least Squares Regression (GLS) and clicking the 'Next' button
presents further procedures that may be run with this one (Figure 9). In the case of
Generalized Least Squares the available tasks that may follow are the specification of
restrictions, the construction of hypothesis tests and/or confidence intervals and
forecasting. When using the wizards to perform more than one of these tasks at once it is
recommended they be used to construct the commands for these tasks rather than being
used to perform the procedures immediately.
After selecting additional tasks, selecting the 'Go...' button opens the appropriate wizard.
The wizard constructed for GLS includes additional pages for each extra task selected in
Figure 9. Figures 10-13 below show each page separately. In Figure 10 the first step is the
selection of variables, the setting of the sample size and the specification of any lags for
exogenous variables. Variables already loaded into memory appear in the 'System' section
in the 'Variables Available' box.
Figure 9: Selecting Additional Procedures
Figure 11 shows the specific options available for the GLS command. In the majority of
wizards the only difference between them and the GLS wizard here are the options
presented on this page. The options are described in detail in each of the chapters that deal
with the particular procedure in question in the SHAZAM Users Manual. A separate
wizard is available for each chapter.
Because 'Forecasting' was selected the forecasting page appears as Figure 12 with
additional options. Forecasting options that cannot be used for GLS are disabled.
Figures 10 & 11: Selecting Variables and Options for Generalized Least Squares
Figures 12 & 13: Forecasting and Execution Options
Figure 13 shows the final step in a typical wizard. The 'Execute Immediately' option
produces output instantly in a new output window. Using the 'Generate commands'
option allows the saving and re-execution of commands or the incorporation of them into a
larger program.
When the �Finish’ button is pressed any incompatible selections or combinations are
detected and the user is prompted if any specific changes are needed. In some cases the
characteristics of the data being used in combination with the estimation attempted
produce statistical problems that are only detectable when estimation is carried out e.g.
multicollinearity, heteroscedasticity, serial correlation or non stationarity; to name a few.
Consequently �errors’ using the wizards will appear in the same way that errors are
received running commands from a command file. Diagnosing such errors or warnings
requires knowledge of the statistical or econometric procedure used.
If the 'Generate commands' option is selected, commands may then be edited by hand or
by using the wizard. This by performed by using the left mouse button to click on the
command line and then using the right mouse button to select 'Edit Command...', as shown
in Figure 14.
Figure 14: Editing Commands Using SHAZAM Wizards
This will launch the correct wizard with the chosen options automatically selected in the
wizard. Changes can be made using the wizard and on completion (pressing the �Finish’
button) the changes will be made to the line in the command editor that was edited.
One special wizard is the �Variables’ wizard. This wizard has a menu option on the �Run’
menu and may also be selected by pressing the F12 key. The �Variables’ wizard displays
the list of variables currently loaded into memory. Additional options allow the writing to
file or the printing to screen of one or more of the available variables.
For more details about the options particular to each wizard please consult the appropriate
chapter for each procedure in the SHAZAM manual.
General program options are available on the �Project’ menu. The options dialog allows
the changing or resetting of general default options related to the command editor,
graphing, file locations, startup options and options related to single window mode.
Figure 15: General Options
Some particularly useful options include the �Autosave command editor on Step or Run’
which forces any edited changes to be saved before running the program, and the
�Automatically load last project’ option on the startup tab. To prevent graphs appearing in
SHAZAM as they are created the �Hide graphs’ option may be used.
SHAZAM Professional edition contains online HTML help that can be accessed using
either the �Help’ menu or from the tab labeled �Help’ on the left hand toolbar. Online help
is arranged in the following sections:
Introduction to SHAZAM – Provides in some detail a simple to follow guide to using
the most common features of SHAZAM.
Users Guide – Includes information on using the Professional Edition along with a
number of added examples showing how to use the Advanced Data Connector and other
useful features.
Command Reference – Details each command and the associated options.
About SHAZAM – A brief history of SHAZAM.
To obtain help about this edition of SHAZAM please consult the SHAZAM website at From time to time updates to SHAZAM are made and these
may also be obtained from the SHAZAM website. Further help may be obtained by
emailing us at
Без категории
Размер файла
787 Кб
Пожаловаться на содержимое документа