|
|
|
|
|
|
時系列分析ソフトウェア
RATS |
|
3-2. RATS Basics: Reading In Data
Now we need to read our data from a disk file into memory. We do that with the OPEN DATA and DATA instructions. OPEN DATA specifies the name of the file containing the data, while DATA actually does the work of reading the data from the file.
Our Example Program
After adding the appropriate OPEN DATA and DATA instructions, our example program looks like this:
CALENDAR 1922
ALLOCATE 1941:1
OPEN DATA C:\RATS\FOODDATA.RAT
DATA(FORMAT=RATS) / FOODCONS PRRETAIL DISPINC FOODPROD PRFARM
In this case, our data is stored on a RATS format file called FOODDATA.RAT, located in the directory C:\RATS. FOODCONS, PRRETAIL, etc., are the names of the series we want to read in (consumption of food products, retail prices, etc.).
Other File Formats
RATS format is specially designed to handle time series data. You may find it convenient to convert your data to RATS format, but it's certainly not required, because RATS can read data directly from many other types of files, including text files, WKS or Excel spreadsheets, dBase files, and MicroTSP files. You can also write data to any of these file formats using the COPY instruction.
Here's how you would read the same data set from a WKS format file and a free-format (comma, tab, or space delimited) text file, respectively:
OPEN DATA FOODDATA.WKS
DATA(FORMAT=WKS,ORG=OBSERVATION)
OPEN DATA FOODDATA.DAT
DATA(FORMAT=FREE,ORG=OBSERVATION) / FOODCONS PRRETAIL DISPINC FOODPROD PRFARM
Converting Data Frequencies
The DATA instruction provides many options for automatically converting data from a higher frequency to a lower frequency, including taking averages, sums, or geometric means, or selecting particular subperiods. For example, you could convert monthly data to quarterly data by taking averages, or by taking the value of the third month of each quarter. RATS also includes two procedures for interpolating low frequency data to a higher frequency.
|
|
|
←RATSのTopページに戻る |
|
|