BookmarkSubscribeRSS Feed
caveman529
Calcite | Level 5

I hope to use statistical procedure to partition a variable of a panel dataset into cross-sectional variation and time-series variation (within and between variation).  Suppose my data looks like:

Y              X             ID            DATE

I hope to know how Y varies cross-sectionally according to ID holding DATE fixed.  I also hope to know how Y varies according to DATE time-series, holding ID fixed.  My description may not conform to statistical lingo, could you offer me some advice on how to do so?  Thank you –

2 REPLIES 2
ets_kps
SAS Employee

Hello,

Here is how you request the variance decomposition from the procedure. It gives you the within and between variation for the VC model.  You can grab this example and run it in SAS.  Also, to get the full output from the procedure, simply delete the line "ods select VarianceComponents". I included it to keep your output as small as possible.

data greene;

   input firm year production cost @@;

datalines;

1 1955   5.36598   1.14867  1 1960   6.03787   1.45185

1 1965   6.37673   1.52257  1 1970   6.93245   1.76627

2 1955   6.54535   1.35041  2 1960   6.69827   1.71109

2 1965   7.40245   2.09519  2 1970   7.82644   2.39480

3 1955   8.07153   2.94628  3 1960   8.47679   3.25967

3 1965   8.66923   3.47952  3 1970   9.13508   3.71795

4 1955   8.64259   3.56187  4 1960   8.93748   3.93400

4 1965   9.23073   4.11161  4 1970   9.52530   4.35523

5 1955   8.69951   3.50116  5 1960   9.01457   3.68998

5 1965   9.04594   3.76410  5 1970   9.21074   4.05573

6 1955   9.37552   4.29114  6 1960   9.65188   4.59356

6 1965  10.21163   4.93361  6 1970  10.34039   5.25520

;

proc sort data=greene;

   by firm year;

run;

proc panel data=greene ;

   model cost = production / rantwo vcomp = fb ;

   ods select VarianceComponents;

   id firm year;

  

run;

caveman529
Calcite | Level 5

Thank you, KPS!  I'll try it out and report back.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Discussion stats
  • 2 replies
  • 2600 views
  • 0 likes
  • 2 in conversation