STATISTICA







Calling STATISTICA BASIC from within Visual Basic

Example: This example uses the SHELL function to run the SCL program, Matrix.scl. The SCL program contains a call to a STATISTICA BASIC program, Matrix.stb, which calculates the eigenvalues for the correlation matrix created from the Poverty.sta file. The eigenvalues are then stored in a STATISTICA data file, Eigenval.sta, so that the eigenvalues can be accessed by your source application using the STATISTICA Development Environment.

If you would like to run this example, you may download CallSCL.zip. After unzipping this program (using WinZip or by renaming it as a self-extracting zip file CallSCL.exe), you can run the setup program to install the CallSCL Visual Basic application. You will need to install the program in a specific directory: c:\callscl. You can also open the Visual Basic project files directly if you have Visual Basic 5.0 loaded on your computer.


Visual Basic Code
Private Sub Command1_Click()
' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
' Run matrix.scl.
RetVal = Shell("c:\stat\sta_run.exe c:\callscl\matrix.scl", 1)
End Sub
STATISTICA Command Language Code
File = "c:\callscl\poverty.sta" {opens the data file}
STBASIC
	PROGRAM = "c:\callscl\matrix.stb" {calls the STATISTICA BASIC program}
STATISTICA BASIC Code
RandomAccess;
ReDim corr(NVars, NVars);
ReDim eigenval(NVars);
MatrixCorrelations(Data, 1, corr); {calculate the correlation matrix}
MatrixEigenvalues(corr, eigenval, numeigen); {calculate the  eigenvalues}
MatrixSaveAsDataFile (eigenval, "c:\callscl\eigenval.sta"); {save the eigenvalues in an .sta file}
Back to List of Programs


[StatSoft]
2300 East 14th Street, Tulsa, OK 74104
Phone: (918) 749-1119; Fax: (918) 749-2217

[StatSoft]e-mail: info@statsoft.com

©Copyright StatSoft, Inc., 1984-2005.
StatSoft, StatSoft logo, STATISTICA, SEWSS, SEDAS, Data Miner, SEPATH and GTrees are trademarks of StatSoft, Inc.