RATS 10.1
RATS 10.1

PFORM( options )   newseries start end

# input variable or variables

 

Forms a panel data series from either a set of several series (each containing data for one individual), or a single series which contains data for both individuals and time periods, but in a different ordering than the one required by RATS. PFORM is usually employed in a short program which rearranges and rewrites the dataset. The new dataset is then analyzed with other RATS programs.

 

The supplementary card can be a list of several series (each containing data for one individual), or a single series that needs to be re-ordered to conform to the panel organization supported by RATS, using either the TRANSPOSE/BLOCK options, or the INDIVIDUAL and/or TIME options.

Parameters

newseries

The series to be constructed with correct form for a RATS panel data set

start, end

range of the input series to use

Supplementary Card

input variables

This can be a list of several series (each containing data for one individual), or a single series that needs to be re-ordered to conform to the panel organization supported by RATS.

Options

INPUT=[INDIV]/TIME

The default behavior for PFORM is to take a set of series where each series contains the data for one individual (across time), and stack those "individual" series into a single “panel” series. Use INPUT=TIME if you instead have separate series for each time period (that is, a given series contains data for all individuals for a single time period). You can also use the TRANSPOSE, INDIVIDUAL, and/or TIME options described below to handle other situations—any of those options will override the INPUT=INDIV default.

 

TRANSPOSE/[NOTRANSPOSE]

BLOCK=number of individuals per time block

If the input is a single series containing balanced panel data (each individual has data for the same set of time periods), but is blocked by time, rather than by individual, the combination of TRANSPOSE plus BLOCK will cause the input variable to be transposed into a series blocked by individual.

 

INDIVIDUAL=series with identifiers for individuals [not used]

TIME=series with identifiers for time periods [not used]

These allow you to supply index series with numeric codes identifying the individual and the time period for the corresponding entry of input series. These are useful if you have an unbalanced panel (different individuals have different numbers of observations), or if the series is not in any regular order.

 

REPEAT/[NOREPEAT]

If you have a series which is common to all individuals (there should be only one input variable), and you have already set up a panel CALENDAR scheme, PFORM with REPEAT will replicate one set of data across all individuals.

Variables Defined

%NGROUP

number of individuals in the created series (INTEGER)

%NOBS

number of time periods in the created series (INTEGER)

Description

PFORM constructs newseries as a series with the proper panel form: balanced (same number of time periods for each individual, although the series can contain missing values), and blocked by individuals (entries 1 through T contain all data for individual 1, entries T+1 to 2T contain all data for individual 2, etc.). It constructs one series at a time. PFORM can handle three different forms of input data:

 

Each individual is in a separate series

List the set of series on the supplementary card. Set start and end to the range of each of these you want included in the concatenated series. If you leave start and end blank, they will default to the maximum range covered by the input series, with missing values used to pad individual’s records which are shorter.

 

Each time period is in a separate series

If you have a separate series for each time period, list the set of series on the supplementary card and use the INPUT=TIME option.

 

Single series, balanced panel, but data blocked by time, not individual

If you have a series blocked by time rather than by individual (first N observations contain data for time period 1 for all individuals, next N observations contain data for time period 2, etc.), supply the series on the supplementary card, use the TRANSPOSE options to tell RATS to reorder the data, and the BLOCK option to tell it the number of individuals.

 

Single series, possibly unbalanced, with a separate index series

If your series is unbalanced, or isn’t in any regular order whatsoever, you can still form a panel series if you have separate index or “tag” series that identify the individuals and time periods. List the single input series on the supplementary card and use the INDIVIDUAL and TIME options to supply your index series. If you use TIME but not INDIVIDUAL, RATS assumes that the first time a value of the TIME series occurs, it is on an observation for the first individual; the second time is for the second individual, etc. Similar assumptions apply if you use INDIV but not TIME.


 

Regardless of the options, transform each of the series in your data set first. Then set the CALENDAR to describe your data set and either continue your analysis, or save the data to a new data file. The variable %NOBS is set to the number of observations per individual, which is the proper value for the PANELOBS option on CALENDAR.

Example

This creates a single panel series from eight separate time series and resets the CALENDAR to the appropriate values.

 

open data panel.xls

calendar(q) 1980:1

data(format=xls,org=columns) 1980:01 2008:01 australia canada france $

  germany japan netherlands uk us

*

* Form the separate series into a single panel data series

*

pform exrate

# australia canada france germany japan netherlands uk us

*

* Reset the calendar for panel data

*

cal(panelobs=%nobs,q) 1980:1

all %ngroup//2008:1


 

This reblocks an unbalanced sample using the ID and TIME options to identify the two dimensions.

 

*

* Replication file for Arellano and Bond(1991), "Some Tests of

* Specification for Panel Data: Monte Carlo Evidence and an Application

* to Employment Equations," Review of Economic Studies, vol 58, no. 2,

* 277-97.

*

* This is an unbalanced data set. To get the proper alignment for the

* instruments, we need to block it in balanced form. Note that while the

* data can be unbalanced, it has to have consecutive time periods within

* each individual, that is, there can't be any gaps.

*

open data abdata.dta

data(format=dta) 1 1031 ind year emp wage cap indoutpt n w k ys $

 rec yearm1 id nl1 nl2 wl1 kl1 kl2 ysl1 ysl2 yr1976 yr1977 yr1978 $

 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984

*

* n, w, k and ys are the logged values of emp, wage, cap and indoutpt

*

pform(indiv=id,time=year) p_n

# n

pform(indiv=id,time=year) p_w

# w

pform(indiv=id,time=year) p_k

# k

pform(indiv=id,time=year) p_ys

# ys

pform(indiv=id,time=year) p_year

# year

*

cal(panel=%nobs)

all %ngroup//%panelobs()


 


Copyright © 2025 Thomas A. Doan