I downloaded the tspdlib package and installed it. However, when I want to perform a panel data analysis, I encounter various errors. For example, when I analyze Lee, J., Tieslau, M. (2017), "Panel LM Unit-root Tests with Level and Trend Shifts", I get the error
undefined symbols __FILE_DIR. Can you give information about how this system works?
On the other hand, when I run the src file of Nazlioglu, S., Karul, C. (2017), "The panel stationary test with gradual shifts: an application to international commodity price shocks ", I can't see the results. Where can we see the results?
__FILE_DIRwas first introduced in GAUSS version 19. So if you are running an older version of GAUSS, you will get an undefined symbol error when you run code which references it.
__FILE_DIRreturns a string that contains the folder in which the program you are running exists. Its purpose is to allow GAUSS to find a data file without having to specify the location of the file, or changing your GAUSS working directory. You can read more about
- SRC files are used to define procedures or functions. They don't execute the function. To see any output, you need to run a file which loads data and calls those functions. Our Guide to GAUSS Packages discusses how to run examples.
To run these examples with your older version of GAUSS, you will need to replace the statement which looks like this:
// Create file name data_file = __FILE_DIR $+ "../examples/dataset.csv";
// Create file name data_file = "dataset.csv";
__FILE_DIR will not find the location of your dataset any more, you will need to set your working directory to the location of the data file. This post discusses how to find and set your current working directory.
The __FILE_DIR Statement
__FILE_DIR statement is a tool for easily specifying a file path. This was first made available in GAUSS 18, so if you do not have GAUSS 18 or higher, you will need to change this to manually specify the data path.
Whenever GAUSS sees
__FILE_DIR in a program, it replaces it with the full path to the location of the file which contains the
pdlmlevel.e file, lines 9-10 read:
// Load date file y = loadd(__FILE_DIR $+ "PDe.dat");
This means that GAUSS will look in the same directory that the file
pdlmlevel.e is located in to load the data
PDe.dat. If the
tspdlib library has been installed correctly, this should in your GAUSS home directory in the directory
For more information about
__FILE_DIR and data paths, I suggest reading our blog, "Make your code portable: Data paths".
Running a .src file
To use procedures found in the tspdlib library, you need to use the examples files (not the src files) as templates. You can find these files in your GAUSS home directory in the
In general, it will be helpful to keep a few things in mind about GAUSS libraries.
- When working with GAUSS packages, files that end in
.srcare source code files and provide procedure definitions but generally do not call the procedures. This means that running
.srcfiles will not produce any results. You generally will never need to access the
- Example files, especially in official GAUSS packages, usually end in
.e. These files are program files that can be used as templates for running your own programs and will produce results.
Finally, while these blogs do not explicitly speak about working with the
tspdlib library, they do show how to have success in GAUSS working with other people's code. I suggest watching the following two video blogs dedicated to helping you work with publicly available GAUSS code: