(STATISTICA Visual Basic) Overview
The STATISTICA Visual Basic
language (integrated into STATISTICA)
is compatible with the industry standards and offers incomparably more
than just a "supplementary application programming language"
that can be used to write custom extensions.
Note that STATISTICA
Visual Basic (SVB) is not Microsoft Visual Basic 6.0. StatSoft owns and
maintains the code for STATISTICA
Visual Basic. SVB is compatible with Microsoft's VB.NET, Microsoft's Visual
Basic for Applications (VBA), and also with Microsoft's Visual Basic 6.0
(VB6). SVB scripting language is unique in terms of its flexibility and
compatibility, and it is also very powerful. It provides access to Visual
Basic for Applications (used for scripting Microsoft Office products)
and access to the .NET Framework within the same file (see STATISTICA
Programming in VB.NET Overview). Other APIs can also be accessed and
leverage the flexibility of SVB, such as, for example, Yahoo's Stock Quote
API or Google Analytics API. SVB offers a powerful 64-bit solution for
system integration, expansion, and custom development.
STATISTICA Visual Basic (SVB)
takes full advantage of the object model architecture of STATISTICA
and is used to access programmatically every aspect and virtually every
detail of the functionality of the program. Even the most complex analyses
and graphs can be recorded into Visual Basic (SVB) macro programs and
later be run repeatedly or edited and used as building blocks of other
applications. STATISTICA Visual
Basic adds an arsenal of more than 14,000 new functions to the standard
comprehensive syntax of Microsoft Visual Basic thus comprising one of
the largest and richest development environments available.
STATISTICA Visual Basic programs.
There are several methods in which STATISTICA
Visual Basic programs can be created:
Recording a macro.
When you run an analytic procedure (from the Statistics
tab or menu) or create a graph (from the Graphs
tab or menu) the Visual Basic code corresponding to all design specifications
as well as output options are recorded in the background. Entire interactive
STATISTICA analysis sessions
involving different types of analyses can be recorded via the Master Macro
facility [via Start Recording Log of
Analyses (Master Macro) on the Tools
- Macro menu]. That code can later be executed repeatedly or edited
by changing options, variables, data files, optionally adding a user interface,
SVB development environment.
Programs can be written from scratch using the STATISTICA
Visual Basic professional development environment featuring a convenient
program editor with a powerful debugger (with breakpoints, etc.), intuitive
dialog painter, and many facilities that aid in efficient code building.
Visual Basic from other
applications. SVB programs can also be developed by enhancing Visual
Basic programs created in other applications (e.g., Microsoft Excel),
by calling STATISTICA functions
STATISTICA Visual Basic programs. STATISTICA Visual Basic programs can
be executed from within STATISTICA,
but because of the industry standard compatibility of STATISTICA
Visual Basic, you can also execute its programs from any other compatible
environment (e.g., Microsoft Excel, Microsoft Word, or a stand-alone Visual
Basic language). In practice, you would typically call STATISTICA
functions from Visual Basic in another application. Note, however, that
when you run a STATISTICA Visual
Basic program or attempt to call STATISTICA
functions from any other application, all calls to the STATISTICA
specific functions (as opposed to the generic functions of MS Visual Basic)
will be executed only if the respective STATISTICA
libraries are present on the computer where the execution takes place.
That is, the user of the program must be a licensed user of the respective
STATISTICA libraries of procedures.
Note that this large library of STATISTICA
functions (more than 14,000 procedures) is transparently accessible not
only to Visual Basic (either the one that is built in, or a different
one), but also to calls from any other compatible programming language
or environment, such as C/C++,
Java, or Delphi.
for STATISTICA Visual Basic programs.
STATISTICA Visual Basic programs
can be used for a wide variety of applications from simple macro (SVB)
programs recorded to automate a specific (repeatedly used) sequence of
tasks, to elaborate custom analytic systems combining the power of optimized
procedures of STATISTICA with
custom developed extensions featuring their own user interface. Scripts
for analyses developed this way can be integrated into larger computing
environments or executed from within proprietary corporate software systems
or intranet or Internet portals. SVB programs can also be attached to
virtually all important "events" in an analysis with STATISTICA
such as opening or closing files, clicking on cells in spreadsheets, etc.;
in this manner, the basic user interface of STATISTICA
can be highly customized for specific applications (e.g., for data entry
of STATISTICA Visual Basic programs. While
the obvious advantages of Visual Basic (compared to other languages) are
its ease of use and familiarity to a very large number of computer users,
the possible drawback of Visual Basic programs is that they do not perform
as fast as applications developed in lower level programming languages
(such as C). However, that potential problem does not apply to STATISTICA
Visual Basic applications, especially those that rely mostly on executing
calls to STATISTICA's analytic,
graphics, and data management procedures. These procedures fully employ
STATISTICA technology and perform
at a speed comparable to running the respective procedures in STATISTICA
STATISTICA Visual Basic. STATISTICA Visual Basic consists
of two major components: (1) The general Visual Basic Programming Environment
with facilities and extensions for designing user interfaces (dialogs)
and file handling, and (2) the STATISTICA
libraries with thousands of functions that provide access to practically
all functionality of STATISTICA.
The STATISTICA Visual Basic
programming environment follows the industry standard syntax conventions
of the Microsoft Visual Basic Language; the few differences pertain mostly
to the manner in which dialog boxes are created (see Custom
Dialogs; Custom User Interfaces), and are designed to offer programmers/developers
more flexibility in the way user interfaces are handled in complex programs.
In the STATISTICA Visual Basic
programming environment, dialog boxes can be entirely handled inside separate
subroutines, which can be flexibly combined into larger multiple-dialog
programs; MS Visual Basic is form based, where the forms or dialog boxes,
and all events that occur in the dialog boxes, are handled in separate
Recording SVB Macros
(Programs): Macros, Master (Log) Macros,and Keyboard Macros. STATISTICA provides a comprehensive
selection of facilities for recording macros (SVB programs) to automate
repetitive work or to be used as a means to automatically generate programs
for further editing and modification. The macro (STATISTICA
Visual Basic) programs recorded by these facilities can be saved to be
run "as is," or they can be used as the "building blocks"
for more complex and highly customized Visual Basic application programs.
There are three general categories of macros that can be automatically
created as you run the program:
Analysis Macros. First, you
can record simple Analysis Macros from an analysis to record the settings,
selections, and chosen options for that specific analysis. (Note that
the term "analysis" in STATISTICA
denotes one task selected either from the Statistics
or Graphs menu, which can be
very small and simple (e.g., one scatterplot requested from the Graphs menu), or very elaborate (e.g.,
a complex structural equation modeling analysis selected by choosing that
command from the Statistics menu,
and involving hundreds of output documents). After selecting any of the
statistical commands from the Statistics
menu or graphics commands from the Graphs
menu, all actions such as variable selections, option settings, etc. are
recorded "behind the scenes;" at any time you can then transfer
this recording (i.e., the Visual Basic code for that macro) to the Visual
Basic Editor window. Note that the Create
Macro command is available from every analysis via the Options
menu or the shortcut menu (accessed by right-clicking the analysis button)
when the respective analysis is minimized.
Master Macros (Logs). Second,
you can record a Master Macro or Master Log of your entire session that
can consist of several or many analyses; this recording will "connect"
analyses performed with various analysis options from the Statistics
or Graphs menu. However, unlike
simple Analysis Macros, you can turn the recording of Master Macros on
or off. The Master Macro recording will begin when you turn on the recording,
and it will end when you stop the recording. In between these actions,
all file selections and most data management operations are recorded,
as are the analyses and selections for the analyses, in the sequence in
which they were chosen.
Keyboard macros. When you select
Start Recording Keyboard Macro
from the Tools - Macro menu,
STATISTICA will record the actual
keystrokes you enter via the keyboard. When you stop the recording, a
STATISTICA Visual Basic editor
window will open with typically a very simple program containing a single
with symbols that represent all the different keystrokes you performed
during the recording session. Note that this type of macro is very simple
in the sense that it will not record any context in which the recorded
keystrokes are pressed and will not record their meaning (i.e., commands
that these keystrokes will trigger), but this feature makes them particularly
useful for some specific applications.
All three follow the identical syntax and can later be modified, but
because of the different ways in which each of them is created, they offer
distinctive advantages and disadvantages for specific applications.
STATISTICA Visual Basic Editor and Debugger.
The STATISTICA Visual Basic environment
includes a flexible program editor and powerful debugging tools. These
facilities are described in greater detail in Editing
and Customizing Recorded Macro (SVB) Programs.
When editing macro programs by typing in general Visual Basic commands
or program commands specific to STATISTICA
Visual Basic, the editor displays type-ahead help to illustrate the appropriate
Help on the members and functions for each class (object) is also provided
in-line (see also The
STATISTICA VB Object Model).
When executing a program, you can set breakpoints in the program, step
through line by line, and observe and change the values of variables in
the macro program as it is running.
To summarize, STATISTICA Visual Basic is not only a powerful programming
language, but it represents a very powerful, professional programming
environment for developing simple macros as well as complex custom applications.
Using this Documentation.
To test and modify the example STATISTICA
Visual Basic (SVB) programs discussed in this SVB documentation, copy
the respective sections from the electronic help and paste them into the
Visual Basic editor window.
For further information, see:
Visual Basic (SVB) Programming Environment
STATISTICA VB Object Model
Libraries and Modules
Rules for Simple SVB Programs
Simple Macro (SVB) Programs, Documenting an Analysis
and Customizing Recorded Macro (SVB) Programs
New Applications, Opening Files, Printing
Functions for Editing Objects (Spreadsheets, Graphs, Etc.)
Dialogs; Custom User Interfaces
STATISTICA Events with SVB Programs
Toolbars and Menus via STATISTICA
Matrix and Statistical Function Libraries
STATISTICA from Visual Basic
in Other Applications (Excel, Word, etc.)