Macro (SVB) Programs Example - Accessing Results Spreadsheet Data

Here is an example of how the values in a results spreadsheet can be used as input data for another analysis; specifically, this program makes a results spreadsheet with descriptive statistics, and then use the column of means from that results spreadsheet to produce a normal probability plot (of means).

Sub Main 
' Create the Statistica Basic Statistics Analysis object; 
' open the input data spreadsheet (example file) 10items.sta 
' NOTE: This file may reside in a different directory on 
' your installation.

Dim s As Spreadsheet
Set s = Spreadsheets.Open _ (Path & "\Examples\DataSets\10Items.sta")
Set newanalysis = Analysis (scBasicStatistics, s)

' 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 all variables 1-10.
newanalysis.Dialog.Variables = "1-10"

' Make the Summary results (descriptive statistics) spreadsheet.
Dim s1 As Spreadsheet
Set s1 = newanalysis.Dialog.Summary(1)

' Create a 2D Probability Plots object; use the results ' Spreadsheet from the previous analysis as the input Spreadsheet.
Set newanalysis = Analysis (sc2dProbabilityPlots, s1)

' Request a Normal Probability plot for variable 2 (Means).
With newanalysis.Dialog
.Variables = "Mean"
.GraphType = scProbNormal
End With

' Create the normal probability plot of means for all variables in ' file 10items.sta.
Set PPlot=newanalysis.Dialog.Graphs PPlot.Visible=True

s.Close
s1.Close
End Sub