How Do I Assign a Value to a Variable?
Assignment in Statistica Visual Basic is used via the = operator. For example:
Dim Number As Integer
Number = 5
The above example assigns the value 5 to an integer variable called Number.
There are a few stipulations in regards to assignments being valid:
Dim Number As Double 'The following assignment is invalid Number = "Text"
This will not run because a double-precision variable cannot hold a text string. In this example a String variable is recommended, as demonstrated here:
Dim TextString As String TextString = "Text"
Dim Number As Integer 'The following is out of range Number = 2000000
Because the largest integer that an Integer can hold is 32,767, then Number will not be able to handle a value such as 2,000,000. For this example a long-integer data type is recommended, as demonstrated below:
Dim Number As Long Number = 2000000
'Invalid, must be initialized Const MyFavoriteNumber 'Now it's OK Const MyFavoriteNumber = 7 'Invalid, cannot change the value of a constant MyFavoriteNumber = 9