The Statistica VB Object Model
The Statistica libraries contain all functions that allow you to fully program and customize your Statistica application; these functions can be called from other applications that support the standard Visual Basic language, such as Microsoft Visual Basic 6, Microsoft Excel, etc.
SVB is organized around analysis objects; for example, to run an analysis with the Statistica Basic Statistics module, you would first create an analysis object with the constant scBasicStatistics and (optionally) with a data file name (location of the file containing the input spreadsheet). To make access to the thousands of Statistical functions and options available in the Statistica system as convenient as possible, SVB maintains a very close correspondence between the dialogs as they are presented during interactive analyses and the flow of the SVB program. In a sense, once an analysis has been created, such as the analysis via the Basic Statistics module in the example, you simply "program the dialogs" for the respective Statistical analysis:
Sub Main
' NOTE: The datafile may reside in a different directory on ' your installation. Also, if you recorded this portion of ' the code via a Master Macro [option Tools - Macro - Start ' recording of log of analyses (Master Macro) ], consecutive ' analyses would be enumerated as newanalysis1, newanalysis2, ' etc., and the input datafile spreadsheets would be explicitly ' assigned to variables (objects) S1, S2, etc.
Set newanalysis = Analysis (scBasicStatistics, _ Path & "\Examples\Datasets\exp.sta")
newanalysis.Dialog.Statistics = scBasDescriptives newanalysis.Run newanalysis.Dialog.Variables = "1-8"
' NOTE: the following line illustrates the simplest way to ' produce a visible results spreadsheet; when recording ' macros from analyses, various additional system settings ' (e.g., output options) are also recorded, and results ' spreadsheets and graphs are typically handled via the ' RouteOutput method.
newanalysis.Dialog.Summary.Visible = True
End Sub
You can think of each dialog as a property of the (e.g., Basic Statistics) analysis, and of each option, selection, etc. on that dialog as a property of that dialog. Thus, you first invoke a module by declaring the respective analysis object, and then set the desired options etc. as properties of the analysis (and the dialogs of that analysis). Note that when designing actual programs, the automatic macro recording facilities of Statistica do most the programming work for you. You simply run the desired analyses interactively, and then create the macro for those analyses; that macro will contain all of the programming code to recreate the analysis step by step, and it can easily be edited (copied, pasted) to create the desired customized application.
newanalysis.RouteOutput(newanalysis.Dialog.Summary).Visible=True
The RouteOutput method takes as an argument the Summary collection (of spreadsheets, graphs, or both) and places it into the workbook, report, etc. depending on the current selections on the Analysis/Graph Output Manager. The RouteOutput method actually returns an object of type AnalysisOutput which itself has a number of methods and properties to make it fully "programmable."
In other words, case selection conditions or case weights defined for a data file can be thought of as the actual data (numbers) themselves, i.e., they "belong" to the data file and describe the nature of the data (instead of the nature of a specific analysis). So, for example, when you want to create a recording to document a particular analysis that produced specific results, you may want to explicitly set any case selection conditions or case weights as part of your analyses to ensure that they are properly recorded.
Manipulating and editing Statistica documents. Spreadsheets and graphs are only two of the document types that Statistica uses to handle input and output of Statistical analyses. Other document types are (text) reports and workbooks, in which you can organize and manage all other documents. There are a large number of properties and methods available for each of these types of documents that you can use to customize your results or to access aspects of your results for further processing.