RATS 11
RATS 11

TABLE( options )  start end   listofseries

TABLE computes basic statistics on several series. The statistics computed are the number of observations, sample mean, sample standard error, minimum and maximum. It also computes the overall maximum and minimum values of the whole set of series. For a broader range of statistics on a single series, see STATISTICS.

Wizard

If you create a Series Window, you can also get a statistics table by selecting the desired series and clicking on the

Parameters

start, end

estimation range. By default, the maximum range of each series separately.

listofseries

list of series to include. If left blank, all current series.

Options

SMPL=Standard SMPL option [unused]

WEIGHT=Standard WEIGHT option [unused]

If you use either option, it applies to all series in the list.
 

[PRINT]/NOPRINT

TITLE=”title for output” [none]

Use NOPRINT if you want to suppress the displaying of the output on the screen. This will only make sense if you are TABLE to get the maximum and minimum across the list or are using the MATRIX option. Use TITLE to supply your own title to label the resulting output.

 

WINDOW="title of window"

If you use the WINDOW option, the output goes to a Report Window with the given title, rather than being inserted into the output window or file as text. Note that even without the WINDOW option, you can reload the report from the Reports Windows list on the Window menu.

 

PICTURE="picture code for statistics"

A picture code lets you control the formatting of the numbers in the output.

 

MATRIX=RECTANGULAR array for statistics [unused]

You can use the MATRIX option to save the computed statistics into a K × 5 array, where K is the number of variables in the listofseries. In each row, column one contains the number of observations, column 2 the mean, column 3 the standard error, column 4 the minimum value, and column 5 the maximum value.

Variables Defined

%MAXIMUM

maximum value found in the listofseries (REAL)

%MINIMUM

minimum value found in the listofseries (REAL)

Notes

It’s always a good idea to use a TABLE instruction immediately after the DATA instruction, particularly the first time you use a data set. It gives you a quick way to check whether your data are in good shape. For instance, you can easily detect series which have missing data because the number of observations will not match with those for other series. You might also have a series whose data range doesn’t match with what you expect. TABLE can help you spot series which have problems, but you will have to use PRINT or some other instruction to isolate the cause.

 

The sample standard error is computed using an N–1 divisor where N is the number of data points in a series.

 

%MAXIMUM and %MINIMUM are the only variables that TABLE defines that you can access from within your program (except by using the MATRIX option). Use the STATISTICS instruction applied to the series one at a time if you need access to such things as the mean and number of observations.

Examples

This uses TABLE for descriptive statistics on two subsamples of a data set.

 

*

* UNION.RPF

* Adapted from Johnston and DiNardo(1997), pp 415-425

*

open data cps88.asc

data(format=prn,org=columns) 1 1000 age exp2 grade ind1 married $

   lnwage occ1 partt potexp union weight high

*

table(smpl=union,title="Statistics for Union Members") / $

  potexp exp2 grade married high

table(smpl=.not.union,title="Statistics for Non-Union Members") / $

  potexp exp2 grade married high


 

This uses TABLE to get %MAXIMUM and %MINIMUM for the set of series so that all graphs can be done on the same scale.


*

* SPGRAPH.RPF

*

cal(m) 1996

open data oecdsample.rat

data(format=rats) 1996:1 1998:12 canusxsr frausxsr jpnusxsr gbrusxsr

*

* Flip to dollars per foreign unit and assign descriptive labels

*

set canusxsr = 1.0/canusxsr

set frausxsr = 1.0/frausxsr

set jpnusxsr = 1.0/jpnusxsr

labels canusxsr frausxsr jpnusxsr gbrusxsr

# "Canada" "France" "Japan" "UK"

*

* Convert to percent appreciation

*

dofor i = canusxsr frausxsr jpnusxsr gbrusxsr

   compute base=([series]i)(1996:1)

   set i = 100*(i{0}/base - 1.0)

end dofor i

*

* Use TABLE to get the maximum and minimum across all series

*

table(noprint) / canusxsr frausxsr jpnusxsr gbrusxsr

*

* Set up the SPGRAPH for a 2x2 matrix

*

spgraph(vfields=2,hfields=2,header="U.S. Dollar vs Major Currencies",$)

  subheader="Percent appreciation over the sample")

dofor i = canusxsr frausxsr jpnusxsr gbrusxsr

   graph(max=%maximum,min=%minimum,header=%l(i)) 1

   # i

end dofor

spgraph(done)

Sample Output

These are from the first example.

 

Statistics for Union Members

Series             Obs       Mean        Std Error      Minimum       Maximum

POTEXP               216   22.77777778   11.41710942    1.00000000   49.00000000

EXP2                 216  648.57407407  563.34258574    1.00000000 2401.00000000

GRADE                216   12.56018519    2.27342339    5.00000000   18.00000000

MARRIED              216    0.75000000    0.43401854    0.00000000    1.00000000

HIGH                 216    0.76388889    0.42567775    0.00000000    1.00000000

 

Statistics for Non-Union Members

Series             Obs       Mean        Std Error      Minimum       Maximum

POTEXP               784   17.81122449   12.93830834    1.00000000   55.00000000

EXP2                 784  484.42602041  595.76310328    1.00000000 3025.00000000

GRADE                784   13.13903061    2.67619124    0.00000000   18.00000000

MARRIED              784    0.61096939    0.48784152    0.00000000    1.00000000

HIGH                 784    0.51403061    0.50012216    0.00000000    1.00000000


 


Copyright © 2025 Thomas A. Doan