The PANEL Procedure

Example 27.7 Using the FLATDATA Statement

Sometimes the data can be found in compressed form, where each line consists of all observations for the dependent and independent variables for the cross section. To illustrate, suppose you have a data set with 20 cross sections where each cross section consists of observations for six time periods. Each time period has values for dependent and independent variables $Y_1$$Y_6$ and $X_1$$X_6$. The $cs$ and $num$ variables represent other character and numeric variables that are constant across each cross section.

The observations for first five cross sections along with other variables are shown in Output 27.7.1. In this example, i represents the cross section. The time period is identified by the subscript on the Y and X variables; it ranges from 1 to 6.

Output 27.7.1: Compressed Data Set

Obs i cs num X_1 X_2 X_3 X_4 X_5 X_6 Y_1 Y_2 Y_3 Y_4 Y_5 Y_6
1 1 CS1 -1.56058 0.40268 0.91951 0.69482 -2.28899 -1.32762 1.92348 2.30418 2.11850 2.66009 -4.94104 -0.83053 5.01359
2 2 CS2 0.30989 1.01950 -0.04699 -0.96695 -1.08345 -0.05180 0.30266 4.50982 3.73887 1.44984 -1.02996 2.78260 1.73856
3 3 CS3 0.85054 0.60325 0.71154 0.66168 -0.66823 -1.87550 0.55065 4.07276 4.89621 3.90470 1.03437 0.54598 5.01460
4 4 CS4 -0.18885 -0.64946 -1.23355 0.04554 -0.24996 0.09685 -0.92771 2.40304 1.48182 2.70579 3.82672 4.01117 1.97639
5 5 CS5 -0.04761 -0.79692 0.63445 -2.23539 -0.37629 -0.82212 -0.70566 3.58092 6.08917 3.08249 4.26605 3.65452 0.81826



Since the PANEL procedure cannot work directly with the data in compressed form, the FLATDATA statement can be used to transform the data. The OUT= option can be used to output transformed data to a data set.

proc panel data=flattest;
   flatdata indid=i tsname="t" base=(X Y)
            keep=( cs num seed )  / out=flat_out;
   id i t;
   model y = x / fixone noint;
run;

First, six observations for the uncompressed data set and results for the one-way fixed-effects model fitted are shown in Output 27.7.2 and Output 27.7.3.

Output 27.7.2: Uncompressed Data Set

Obs I t X Y CS NUM
1 1 1 0.40268 2.30418 CS1 -1.56058
2 1 2 0.91951 2.11850 CS1 -1.56058
3 1 3 0.69482 2.66009 CS1 -1.56058
4 1 4 -2.28899 -4.94104 CS1 -1.56058
5 1 5 -1.32762 -0.83053 CS1 -1.56058
6 1 6 1.92348 5.01359 CS1 -1.56058



Output 27.7.3: Estimation with the FLATDATA Statement

The PANEL Procedure
Fixed One-Way Estimates
 
Dependent Variable: Y

Parameter Estimates
Variable DF Estimate Standard
Error
t Value Pr > |t| Label
X 1 2.010753 0.1217 16.52 <.0001