#include <oxstd.h>
#import <database>        // required to use Database class

main()
{   decl dbase, y, dy, names;

    dbase = new Database();            // create new object
    dbase->Load("data/data.xls");              // load data

    dbase->Info();                   // print database info
                                        // select variables
    dbase->Select(0, { "CONS", 0, 0, "INC", 0, 0 } );
    dbase->Select(1, { "CONS", 1, 1, "INC", 1, 1 } );
    dbase->SetSelSample(1953, 1, 1992, 3);    // and sample

    y = dbase->GetGroup(0);              // extract group 0
    dy  = y - dbase->GetGroup(1);

    names = {"CONS", "INC", "DCONS", "DINC"};
    print("\nsample variance over ",
          dbase->GetSelSample(),
          "%r", names, "%c", names, variance(y ~ dy) );

    println("\nnumber of observations:  ", dbase->GetSize());
    println("period of observation 9: ", dbase->ObsYear(9),
        " (", dbase->ObsPeriod(9), ")");
    println("database index 1985(4):  ", dbase->GetIndex(1985,4));
          
    delete dbase;            // done with object, delete it
}
