RATS Format |
RATS format is designed for the special problems of time series data. It has many advantages over other formats:
•Data access is more flexible: you can set up a single file with many series and select only the ones you need for a particular application. You can also select a specific set of entries—you don’t have to read in entire series.
•The data series do not need to have identical structures. For example, you can mix monthly, quarterly and daily series on one file and can have series running over different intervals.
•RATS can automatically compact or expand data to match the current CALENDAR frequency.
•There are many ways to add data to a file or edit series already on a file.
•Data retrieval is extremely fast.
RATS also allows a certain amount of flexibility in reading the Labeled Table files: you can select specific series off a file and restrict yourself to a subset of entries, and, under certain circumstances, you can compact and expand. Those, however, will have to
Stored Information
For each series on the file, RATS retains the following information:
•the series name
•the frequency of the data (annual, quarterly, monthly, panel, etc.)
•the dates (or entries) for which the series is available
•up to two lines of comments
•the data itself
Reading Data into RATS
To work with data from a RATS format file, you can:
•Open the file using OPEN DATA, and read the data using DATA(FORMAT=RATS), or
•Open the file using File>Open, select (highlight) the series you want, and use the Data/Graphics>Data (RATS Format) wizard to read in the data.
•Open the file using File>Open and drag and drop series from the RATS file onto the Series Window (displayed using View>Series Window).
With RATS format, you can read any combination of series from the file. You can also read specific sets of observations from the full data set by using the start and end parameters on the wizard or the DATA instruction. This is one of the most important advantages of RATS format.
If you omit the list of series when using DATA, RATS will read all the series on the file. Be cautious when working with large files, or you might read in many unneeded series.
To change the name of the series as stored on the file, you can either open the file using File>Open and use the “Rename” toolbar button (
), or else open the file with DEDIT and use the RENAME instruction.
Instructions for Creating and Editing RATS Files
RATS provides special instructions for creating and editing RATS format data files. Never try to make changes to a RATS data file using a text editor. The instructions for working with RATS format files are:
|
COPY |
When used with the option FORMAT=RATS, this writes a set of series to a new RATS format file. This is the easiest way to write data to a RATS file, but cannot be used to append data to an existing file—use DEDIT, STORE, and SAVE for that. |
|
DEDIT |
initiates the editing of a new or existing file. Once you have opened a file using DEDIT, you can use the following instructions. Several of these are rarely used now, since it’s easier to make changes on-screen using the RATS Data File Window. |
|
STORE |
adds specified series to the file, or converts the contents of a data file of another format. |
|
SAVE |
saves changes to the file. |
|
CATALOG |
produces a directory of series on the file |
|
PRTDATA |
prints one or more of the data series stored on the file. |
|
QUIT |
ends an editing session without saving the changes (do SAVE then QUIT if you want to save changes and then close the file) |
|
EDIT |
performs on-screen editing of an existing or new series. |
|
INCLUDE |
adds a single series to the file. |
|
UPDATE |
makes changes to a small set of entries of an existing series. |
|
DELETE |
deletes a series from the file. |
|
RENAME |
renames an existing series. |
RATS Data File Windows
When you open an existing RATS file using File>Open, or create a new file using File>New>RATSData Window, RATS displays the contents of the file in a window. From this window, you can:
•Read data into memory by selecting the series you want from the data window and then doing Data/Graphics>Data (RATS Format).
•Read data into memory by dragging and dropping series from the RATS file window to the Series Window (displayed using View>Series Window).
•Write data to the RATS file by dragging series from the Series Window and dropping them on the RATS Data File Window.
•Use File>Import to bring data from other files into the RATS format file.
•Use File>Export to export data from the RATS format file.
•Double-click on a series to view or edit the data in that series.
•Select Data/Graphics>Create Series (or click on the
icon) to create a new series on the file.
•Rename a series by selecting the series and clicking on the
icon.
•Use the View>Reset List menu item or
toolbar icon to restrict the list based upon frequency, start or end year, comments or names (or any combination)
•Use the View menu operations or corresponding toolbar icons to display time series graphs, histograms, and box plots, generate a table of basic statistics, or compute a set of autocorrelations for the selected series.
You can also right-click (or <Command>+Click on the Mac) on a series (or list of series) and select operations like “Cut”, “Copy”, and “Export...” from the pop-up menu.
Examples of DATA
Suppose the data file mydata.rat has REAL_GDP, quarterly from 1947:1 to 2018:1, and TBILLS, monthly from 1946:1 to 2018:5.
cal(q) 1947:1 Sets a quarterly CALENDAR
open data mydata.rat
data(format=RATS) 1947:1 2018:1 real_gdp tbills
will read REAL_GNP and quarterly averages (the default compaction option) of TBILLS, over the range 1947:1 through 2018:1.
cal(m) 1954:1 Sets a monthly CALENDAR
allocate 2016:12
open data mydata.rat
data(format=rats) / tbills
will read the (monthly) data for 1954 through 2016 for TBILLS.
Examples of Editing
dedit company.rat
cal(q) 1950:1
open data ascii.dat
data(format=free) 1950:1 2017:4 order invent shipment backlog
store order invent shipment backlog
save
reads four series from a free–format file and saves them on the RATS file company.rat.
cal(d,save=dailycal) 1991:1:2
dedit(new) options.rat
open data options.wks
store(convert=wks,org=col,calendar=dailycal)
save
converts all data from the (undated) WKS file options.wks, creating options.rat. The data will be stored as daily data, beginning with entry 1991:1:2.
Copyright © 2026 Thomas A. Doan