Importing Version 5.x STB Programs to Statistica Visual Basic (Technical Notes)

This topic contains information that may be useful for users of the translation utility distributed with the current version of Statistica to help convert the 5.x generation Statistica Visual Basic programs to Statistica Visual Basic.

Correctness of syntax. The STB import facility should transform any syntactically correct STB program into an SVB script that can be executed in the current version of Statistica. The syntactical correctness means that if a program causes a syntax error when "compiled" in Version 5, it will also produce an error during the process of importing. The most significant consequence of this will be the case when variable names or text value labels from a particular data file are used in the program. If that data file is not loaded as the active data set, neither Version 5 nor the current version will be able to verify the correctness.

Modes of operation. In Version 5, STB had two possible modes of operation: Sequential, when the script was executed for each case in data file, or RandomAccess, when the program was executed only once. In the current version, the sequential method of execution is no longer available; therefore, when translating STB to the current version, function calls and instructions that are proprietary to that method are transformed to a random access convention. This is accomplished by adding a "For" loop that will cycle through all cases in the data set using a variable named LOOP_CASE as case counter.

Untranslatable functions. Most functions and subroutines that were available in STB can be successfully translated to SVB. There are, however, a few exceptions where due to the changes in data file structure, program features and operations, or simply syntactical incompatibility with Visual Basic, a sensible translation was not possible. Below is a list of those functions:
 

Delete

Undefined (in "if…then…else…undefined")

Missing

NoDataFileVariableNames

SelectionConditionsGet

Valid

Value

GraphAddBWPlot

GraphAddMinMaxPlot

GraphAddPlot (if PlotType = PIECHART)

GraphAddPlot (if PlotType = MULTIPATTERNBAR)

GraphAddRangePlot

GraphChangeMappingBase

GraphDrawArrow (if ArrowType = HEAD_FANCY_FILLED, HEAD_FANCY_EMPTY, HEAD_TRIANGULAR_FILLED, HEAD_TRIANGULAR_EMPTY, HEAD_REGULAR_EMPTY, or HEAD_ERROR_BAR)

GraphDrawArrow3D (if ArrowType = HEAD_FANCY_FILLED, HEAD_FANCY_EMPTY, HEAD_TRIANGULAR_FILLED, HEAD_TRIANGULAR_EMPTY, HEAD_REGULAR_EMPTY, or HEAD_ERROR_BAR)

GraphDrawArrowTernary

GraphDrawShapeTernary

GraphDrawTextParam

GraphDrawTextParam3D

GraphDrawTextParamTernary

GraphDrawTextTernary

GraphEmbedGraph3D

GraphEmbedGraphTernary

GraphInsertFile

GraphInsertFile3D

GraphInsertFileTernary

GraphSetBWPlot2Dlayout

GraphSetMappingArea

GraphSetMatrixHistograms

GraphSetObjectAreaStyle

GraphSetObjectLineStyle

GraphSetObjectPatternStyle

GraphSetPieLayout

GraphSetPieStyle

GraphSetPlot2Dlayout

GraphSetPlotBarLineStyle

GraphSetPlotConfidBands

GraphSetPlotFittingParam

GraphSetScaleParam

GraphSetScaleValuesStyle

GraphSetXYZFittingParam

NewGraph (if GraphType = PIECHART)

NewGraph (if GraphType = MULTIPATTERNBAR)

NewMatrix (if MType = MATRIX_COLUMNS)

NewSurface (if FittingType = FIT_USERDEFINED_3D)

NewTernary (if Graphtype = TERNARY_SPACEPLOT)

NewTernary (if Graphtype = TERNARY_DEVIATIONPLOT)

NewTernary (if FitingType = FIT_TERN_USERDEFINED)

SetDrawingMatrixCoordinates

ScrollsheetSetHiliteColor

Read

Untranslatable function parameters. The most problematic issue is the use of DATA, V, and Vn (or variable name) as function/procedure parameters. Listed below are methods of resolution for most cases in which above calls may be used:

V or DATA:

a) RandomAccess, no parameters:

This is usually used as a pointer to the entire "data array" in an active file; thus, it will be translated to:

ADS.Data

Sometimes, however, it is meant to represent only the first column of data [e.g., ValMin(DATA, 1, NCASES, x), which will calculate the minimum of all values in var1 and assign it to x]. In such cases, the SVB program will be rendered incorrect, because the dimensions of arrays don't match (Data - 2dim, 1st parameter of ValMin - 1dim). It should be changed by the user to:

ADS.VData(1)

b) Sequential, no parameters:

This is usually meant to represent the current case, and will be translated as

ADS.CaseValues(LOOP_CASE)

c) RandomAccess, 2 parameters (row,col):

This in most cases is meant to retrieve/set a value in (row,col) cell of the active data file and will always be translated to:

ADS.Value(row,col)

However, it may be used as a pointer parameter in functions/subroutines, in which case you would expect the value to be set by the function/sub. This presents a problem. Example:

ValMin(Arr, 1, 10, DATA(1,1))

In this case, the minimum of the first 10 element of Arr is supposed to be put into the first cell in the data file. It will be translated to:

ValMin(Arr, 1, 10, ADS.Value(1,1))

The program will execute correctly, but nothing will be set in the data file because the ADS.Value(1,1) will retrieve the value from the file, a temporary will be passed to ValMin function, its value will be set accordingly, but will never make it back to the data file. This is probably the most dangerous "invisible" side effect of the translation.

Another problem will arise if a DATA(1,n) is used to denote a pointer to the entire "variable vector." Example: x := ValCount(DATA(1, n), 1, NCASES) is supposed to count the number of valid values in variable n and assign it to x. After translation, when the macro is executed, SVB will issue a message that the 1st parameter is not an array. Fix it by changing to:

ADS.VData(n)

d) Sequential, 1 parameter (col):

This, in most cases, is meant to retrieve/set a value in col'th cell of the current row in the active data file and will always be translated to:

ADS.Value(LOOP_CASE,col)

In STB, it was allowed to use  DATA(1) or V(1) to denote a pointer to the entire row (if the index was not 1, it would not verify correctly in SCL). In such a case, SVB will issue an error message at execution attempt ("Expecting an array parameter" or similar) and it needs to be changed to:

ADS.CaseValues(LOOP_CASE)

Vn (or VariableName):

e) RandomAccess, no parameters:

ValMin(V3, 1, NCASES, x), or ValMin(AGE, 1, NCASES, x)

This represents the entire variable, and will be translated as:

ADS.VData(n)

where n is the variable number determined at the time of translation.

f) RandomAccess, 1 parameter (e.g., V3(i), AGE(i))

This, in most cases, is meant to retrieve/set a value in i'th row of the variable in the active data file and will always be translated to:

ADS.Value(i,n)

where n is the variable number determined at the time of translation.

If used as Vn(1), it may be intended as an entire "variable vector" and will cause SVB to issue an error message at execution attempt ("Array expected"). Should be changed to:

ADS.VData(n)

g) Sequential, no parameters:

This, in most cases, is meant to retrieve/set the value of the variable in the current row of the active data file and will always be translated to:

ADS.Value(LOOP_CASE,n)

where n is the variable number determined at the time of translation.