/******************************************************* Linear Models of Panel Data Using Greene's data (2000) Last modified November 28, 2005 Written by Hun Myoung Park on June 21, 2004 http://www.masil.org/ http://mypage.iu.edu/~kucc625 ********************************************************/ LIBNAME masil 'c:\temp\sas'; /****************************************** IT firm R&D expenditure (OECD 2002) ******************************************/ /* LSDV1 */ PROC REG DATA=masil.rnd2002; MODEL rnd = income d1; RUN; /* LSDV2 */ PROC REG DATA=masil.rnd2002; MODEL rnd = income d1 d2 /NOINT; RUN; /* LSDV3 */ PROC REG DATA=masil.rnd2002; MODEL rnd = income d1 d2; RESTRICT d1 + d2 = 0; RUN; /****************************************** U.S. Airline Cost Data (Greene 2003) ******************************************/ /* Pooled OLS regression */ PROC REG DATA=masil.airline; MODEL cost = output fuel load; RUN; /* One-way group effect model */ /**********************************/ PROC REG DATA=masil.airline; /* LSDV1 */ MODEL cost = g1-g5 output fuel load; TEST g1 = g2 = g3 = g4 = g5 = 0; RUN; PROC REG DATA=masil.airline; /* LSDV2 */ MODEL cost = g1-g6 output fuel load /NOINT; RUN; PROC REG DATA=masil.airline; /* LSDV3 */ MODEL cost = g1-g6 output fuel load; RESTRICT g1 + g2 + g3 + g4 + g5 + g6 = 0; RUN; PROC SORT DATA=masil.airline; BY airline year; PROC TSCSREG DATA=masil.airline; ID airline year; MODEL cost = output fuel load /FIXONE; RUN; PROC PANEL DATA=masil.airline; ID airline year; MODEL cost = output fuel load /FIXONE; RUN; PROC PANEL DATA=masil.airline; /* Between effect model */ ID airline year; MODEL cost = output fuel load /BTWNG; RUN; /* One-way time effect model */ /**********************************/ PROC REG DATA=masil.airline; /* LSDV1 */ MODEL cost = t1-t14 output fuel load; TEST t1=t2=t3=t4=t5=t6=t7=t8=t9=t10=t11=t12=t13=t14=0; RUN; PROC REG DATA=masil.airline; /* LSDV2 */ MODEL cost = t1-t15 output fuel load /NOINT; RUN; PROC REG DATA=masil.airline; /* LSDV3 */ MODEL cost = t1-t15 output fuel load; RESTRICT t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15=0; RUN; PROC SORT DATA=masil.airline; BY year airline; PROC TSCSREG DATA=masil.airline; ID year airline; MODEL cost = output fuel load /FIXONE; RUN; PROC PANEL DATA=masil.airline; ID year airline; MODEL cost = output fuel load /FIXONE; RUN; PROC PANEL DATA=masil.airline; /* Between effect model */ ID year airline; MODEL cost = output fuel load /BTWNG; RUN; PROC SORT DATA=masil.airline; BY airline year; PROC PANEL DATA=masil.airline; /* Between effect model */ ID airline year; MODEL cost = output fuel load /BTWNT; RUN; /* Two-way group and time effect model */ /****************************************/ PROC REG DATA=masil.airline; /* LSDV1 */ MODEL cost = g1-g5 t1-t14 output fuel load; TEST g1=g2=g3=g4=g5=t1=t2=t3=t4=t5=t6=t7=t8=t9=t10=t11=t12=t13=t14=0; RUN; PROC REG DATA=masil.airline; /* LSDV1 + LSDV3 */ MODEL cost = g1-g6 t1-t14 output fuel load; RESTRICT g1 + g2 + g3 + g4 + g5 + g6 = 0; RUN; PROC REG DATA=masil.airline; /* LSDV1 + LSDV3 */ MODEL cost = g1-g5 t1-t15 output fuel load; RESTRICT t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15=0; RUN; PROC REG DATA=masil.airline; /* LSDV3 */ MODEL cost = g1-g6 t1-t15 output fuel load; RESTRICT g1 + g2 + g3 + g4 + g5 + g6 = 0; RESTRICT t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15=0; RUN; PROC SORT DATA=masil.airline; BY airline year; PROC TSCSREG DATA=masil.airline; ID airline year; MODEL cost = output fuel load /FIXTWO; RUN; PROC PANEL DATA=masil.airline; ID airline year; MODEL cost = output fuel load /FIXTWO; RUN; /* One-way random group effect */ PROC SORT DATA=masil.airline; BY airline year; PROC TSCSREG DATA=masil.airline; ID airline year; MODEL cost = output fuel load /RANONE; RUN; PROC PANEL DATA=masil.airline; ID airline year; MODEL cost = output fuel load /RANONE BP VCOMP=WK; RUN; /* One-way random time effect */ /*******************************/ PROC SORT DATA=masil.airline; BY year airline; PROC TSCSREG DATA=masil.airline; ID year airline; MODEL cost = output fuel load /RANONE; RUN; PROC PANEL DATA=masil.airline; ID year airline; MODEL cost = output fuel load /RANONE BP; RUN; PROC PANEL DATA=masil.airline; ID year airline; MODEL cost = output fuel load /RANONE BP VCOMP=WK; RUN; PROC PANEL DATA=masil.airline; ID year airline; MODEL cost = output fuel load /RANONE BP; RUN; /* Two-way random time effect */ /*******************************/ PROC SORT DATA=masil.airline; BY airline year; PROC TSCSREG DATA=masil.airline; ID airline year; MODEL cost = output fuel load /RANTWO; RUN; PROC PANEL DATA=masil.airline; ID airline year; MODEL cost = output fuel load /RANTWO BP2; RUN;