Macro (SVB) Programs Example - Creating Sample Statistics (Descriptives and Correlations)

This program shows how to use the STATISTICA Object Model to create and customize the results spreadsheets from the Basic Statistics module.

'Program creates two spreadsheets: 
'descriptive statistics for all variables 
'and correlation matrix for all variables 
'There is no user interface 

Sub Main

'Start Basic Statistics 
Set newanalysis = Analysis (scBasicStatistics)
'First we do descriptives With newanalysis.Dialog
.Statistics = scBasDescriptives
End With 

newanalysis.Run
'Set descriptives options, select all variables 

With newanalysis.Dialog

.Variables = "*" 
.PairwiseDeletionOfMD = True 
.DisplayLongVariableNames = False 
.ExtendedPrecisionCalculations = False 
.UserDefinedPercentiles = False 
.ValidN = True .Mean = True 
.Median = True .Mode = False 
.GeometricMean = True 
.HarmonicMean = True 
.ConfLimitsForMeans = True 
.Sum = True .StandardDeviation = True 
.Variance = True .StandardErrorOfMean = True 
.MinimumMaximum = True 
.LowerUpperQuartiles = False 
.Range = True .QuartileRange = False 
.Skewness = False .Kurtosis = False 
.StandardErrorOfSkewness = False 
.StandardErrorOfKurtosis = False 
.NormalExpectedFrequencies = False 
.KSAndLillieforsTestForNormality = True 
.ShapiroWilkWTest = False 
.UseNumberOfIntervals = True 
.NumberOfIntervals = 10 
.ConfidenceIntervalForMeansPlot = 95.000000 
.CompressedStemAndLeaf = False
End With

Set s = newanalysis.Dialog.Summary.Item(1) 

'Modify results, we will set mean to be bold and geometric mean italic 
s.Variable(2).Font.Bold = True 
s.Variable(2).Font.Color = RGB(0,0,255) 
s.Variable(5).Font.Italic = True 

'Show descriptives spreadsheet 
s.Visible = True 
Set s = Nothing 

'Make correlation matrix newanalysis.GoBack With newanalysis.Dialog
.Statistics = scBasCorrelationMatrices

End With

newanalysis.Run 'Select all variablesWith newanalysis.Dialog
.VariableList = "*" .DisplayCorrelationMatrix = True 
.CasewiseDeletionOfMD = True .DisplayLongVariableNames = False 
.ExtendedPrecisionCalculations = False 
.PLevelForHighlighting = 0.050000

End With

'Show resulting spreadsheet newanalysis.Dialog.Summary.Visible = True

End Sub