How to get Variable values list in STATSTICA

#1
Hi

I have another question about STATISTICA SVB. Now I 'd like to get a list
of variable values. For grouping variable it is the list of all groups' names. I know how to get it using Variable Properties Menu but how no idea about the way of doing this in SVB macro.
 

JenB

New Member
#2
Here's SVB for unique values of one variable:


Option Explicit
Option Base 1
Sub Main

Dim s1 As Spreadsheet
Dim s2 As Spreadsheet
Dim i As Long
Dim nv As Long
Dim last As Long
Dim VarList() As Long
Dim Values() As Double
Dim Labels As Variant

Set s1 = SelectSpreadsheetDialog(False)
If VarPtr(s1) = 0 Then End
ReDim VarList(s1.NumberOfVariables)
If SelectVariables1(s1, "Variable Selection", 1, 1, VarList, nv, "Select a variable:") = 0 Then End
s1.GetUniqueValues(VarList(1), True, Values(), Labels)
last = UBound(Values)

Set s2 = Spreadsheets.New
s2.Visible = False
s2.SetSize(last, 1)
s2.VariableName(1) = s1.VariableName(VarList(1))
s2.VariableType(1) = s1.VariableType(VarList(1))
For i = 1 To last
If Labels(1) ="" Then s2.Value(i, 1) = Values(i) 'number
If Labels(1)<>"" Then s2.Value(i, 1) = Labels(i) 'text
Next i
s2.Variable(1).AutoFit
s2.VariableHeaders(1).AutoFit
s2.Visible = True​

End Sub