A Simple Statistica Visual BASIC (SVB) Program

In Statistica, select the File tab. Select the New tab, and click Macro to display a new Macro window.

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 dialog boxes 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 dialog boxes" for the respective Statistical analysis:  

Sub Main  
' Create the Statistica Basic Statistics Analysis object;  
' open the input data spreadsheet (example file) Exp.sta  
' NOTE: This file may reside in a different directory on  
' your installation.
  
Dim newanalysis As Analysis
Set newanalysis = Analysis (scBasicStatistics, _  Path & "\Examples\Datasets\exp.sta")
  
' Select from the startup dialog of Basic Statistics, option  
' Descriptives (the first option on the startup dialog).
  
newanalysis.Dialog.Statistics = scBasDescriptives
  
' "Click OK", i.e., Run this dialog.
  
newanalysis.Run 
' On the following dialog, select variables 1-8.
  
newanalysis.Dialog.Variables = "1-8"
' Then make the Summary results spreadsheet, and automatically  ' make it visible.
  
newanalysis.Dialog.Summary.Visible = True
End Sub