STATISTICA







Using STADEV with C/C++
Modifying an existing file

This example adds a variable to an existing STATISTICA data file, fills it with some numbers, and then adds two value labels.

Note that to use STADEV from C/C++ you must include the Development Environment include file ( #include "stadev.h" ) into the source file where you will call the library functions; call the desired functions,and link stadev.dll (for 16-bit programs) or stadev32.dll (for 32-bit programs) to your program.


   HSTAFILE handle = StaOpenFile ("c:\\stat\\files\\mydata.sta");
   if ( handle == 0 ) {
      MessageBox (NULL, "Cannot create STATISTICA file !!!", "Error", MB_OK);
      return;
   }
   // add variable number 5:
   StaAddVars (handle, 4, 1);
   // set new variable name:
   StaSetVarName (handle, 5, "BHPH");
   // insert some values:
   long NC = StaGetNCases (handle);
   for ( long i=1; i <= NC; i++ )
      StaSetData (handle, 5, i, i * 10);
   // add text labels:
   StaAddLabel (handle, 5, 10, "A", "long label for A");
   StaAddLabel (handle, 5, 20, "B", "long label for B");
   // close the handle:
   StaCloseFile (handle);
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-2004.
StatSoft, StatSoft logo, STATISTICA, SEWSS, SEDAS, Data Miner, SEPATH and GTrees are trademarks of StatSoft, Inc.