Data_sum

 

Description

Dataset basic summary (descriptive) statistics.

Syntax

BOOL Data_sum( Dataset * pdsData, BasicStats * pbsStat, Dataset * pdsSumData = NULL )

Parameters

pdsData
[input] Pointer to input dataset
pbsStat
[output] Pointer to returned BasicStats structure (see OC_types.h)
pdsSumData
[output] Pointer to returned dataset containing cumulative sum

Return

Returns TRUE, a BasicStats structure (see OC_types.h), and if specified, a data set containing a cumulative sum of the input data set on success and returns FALSE on failure.

Examples

EX1

// This is a self contained sample program for the function Data_sum, 
// Its sample data is created at the beginning of the program. 
// To run the program, enter the following command in the Script window:
//   Data_sum_ex1
// This will return the result statistics like following, and put 
// the cummulative values to the second column:
//   Applying Data_sum on Data2_A succedded.
//     N = 8
//     Missing = 0
//     Total = 2.869720
//     Mean = 0.358715
//     SD = 0.169819
//     SSDM = 0.201870
//     Min = 0.097000 at #2
//     Max = 0.645290 at #7

void Data_sum_ex1()
{
    BOOL success;
    
    Worksheet wks;
    wks.Create();
    Dataset myInDs(wks,0);
    String strInDsName = myInDs.GetName();

    //******* Create sample data *****************
    myInDs.SetSize(8);
    myInDs[0]=0.3; 
    myInDs[1]=0.097; 
    myInDs[2]=0.41256;
    myInDs[3]=0.24909;
    myInDs[4]=0.47304;
    myInDs[5]=0.2476;
    myInDs[6]=0.64529;
    myInDs[7]=0.44514;
    //******** End of Sample Data Creation ******
        
    Dataset myOutDs(wks,1);
    myOutDs.SetSize(8);
    wks.Columns(1).SetName("Cummulative");

    BasicStats bsStat;  // Data structure of the output statistics

    success = Data_sum(&myInDs, &bsStat, &myOutDs); // Demonstration of Data_sum

    if(success)
    {
        printf("Applying Data_sum on %s succedded.\n",strInDsName);
        printf("  N = %d\n  Missing = %d\n  Total = %f\n  Mean = %f\n"               "  SD = %f\n  SSDM = %f\n  Min = %f at #%d\n  Max = %f at #%d\n",
          bsStat.N, bsStat.Missing, bsStat.total, bsStat.mean, bsStat.sd, 
          bsStat.ssdm,bsStat.min, bsStat.iMin+1, bsStat.max, bsStat.iMax+1);

    }
    else 
        printf("Error: Data_sum failed.\n");
}

Remark

Compute basic summary (descriptive) statistics on an Origin data set.

See Also

header to Include

origin.h

Reference