STATISTICA







Using STADEV with Delphi
Modifying an existing file

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

Note that to use STADEV from Delphi, you must include the stadev32 unit into your compilation: uses StaDev32, call the desired functions, and put stadev32.dll in your path and in the Delphi search path


procedure TestModifyFile;
const
   FileName = 'c:\stat\files\newdata.sta';
var
   hSF: HSTAFILE;
   NC: longint;
   i: longint;
begin
   hSF := StaOpenFile(FileName);
   if (hSF = 0) then
      begin
      writeln('Cannot open STATISTICA file !!!');
      exit;
      end;

   { add variable number 5}
   StaAddVars(hSF, 4, 1);

   { set new variable name}
   StaSetVarName(hSF, 5, 'BHPH');

   {insert some values}
   NC := StaGetNCases(hSF);
   for i := 1 to NC do
      StaSetData(hSF, 5, i, i*10);

   { add text labels}
   StaAddLabel(hSF, 5, 10, 'A', 'long label for A');
   StaAddLabel(hSF, 5, 20, 'B', 'long label for B');
   StaCloseFile(hSF);
end;
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.