How to save the coefficient for very ID after proc panel
Posted: 26 February 2014 05:32 AM   [ Ignore ]
Newbie
Rank
Total Posts:  18
Joined  2011-11-16

Dear Joost,
  Would you like to tell me how to save the coefficient for very ID after running proc panel with fixed two in SAS? I want to keep the coefficient to do the further examine, but I don’t know how to save and match with previous data. I checked the manual and get no hint. So your help are warmly welcome!
Thanks!
KZ

Profile
 
 
Posted: 26 February 2014 07:45 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi KZ,

Could you post the code for that proc that you have so far?

thanks,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 26 February 2014 07:56 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  18
Joined  2011-11-16

proc panel data=a;
  id gvkey fyear;
  model ta=ocft ocft_1 ocft1 ppe sale/fixtwo;
run;

There will be coefficients on CS1-CSn(n=number of firms) beside ocft,ocft_1, ocft1, ppe, sale and I want to save the coefficients on CS1-CSn and merge with data a.
Thanks!
Kai

Profile
 
 
Posted: 26 February 2014 08:47 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi KZ,

proc panel data=a;
  label someVar;
  id gvkey fyear;
  model ta=ocft ocft_1 ocft1 ppe sale/fixtwo;
run;

I am not sure about the semicolon, maybe ‘label’ goes into the first line.

proc panel data=a
  label someVar;
  id gvkey fyear;
  model ta=ocft ocft_1 ocft1 ppe sale/fixtwo;
run;

In dataset a, you can add a key to identify firmyears:

data a;
set a;
someVar = gvkey || fyear;
run;

Maybe this would also work:

proc panel data=a ;
  id someVar;
  model ta=ocft ocft_1 ocft1 ppe sale/fixtwo;
run;

Let me know if this works,

best regards,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 26 February 2014 08:40 PM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  18
Joined  2011-11-16

Hi Joost,
  Thank you for your suggestions. Both programs seem not work.

proc panel data=a;
  label someVar;
  id gvkey fyear;
  model ta=ocft ocft_1 ocft1 ppe sale/fixtwo;
run;

I am not sure about the semicolon, maybe ‘label’ goes into the first line.

proc panel data=a
  label someVar;
  id gvkey fyear;
  model ta=ocft ocft_1 ocft1 ppe sale/fixtwo;
run;

I tried both programs above and results in log window show “=” is expected, and SAS stops running due to the error.

data a;
set a;
someVar = gvkey || fyear;
run;

Maybe this would also work:

proc panel data=a ;
  id someVar;
  model ta=ocft ocft_1 ocft1 ppe sale/fixtwo;
run;

It does not work since there should be both firm id and year id seperatedly according to SAS manual when running fixed two effect using Proc PANEL.

My Idea is to get the unobservable normal accrual using panel data approach, that is, the intercept for very firm, so I have to get the intercept for very firm.

best regards,

Kai

Profile
 
 
Posted: 27 February 2014 08:14 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Kai,

Ok, I see. Did you check out the ‘output =’ options? http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_panel_sect044.htm

In particular the options: _CSID_ (the value of the cross section id) and _TSID_ (value of the time period).

If that does not work, can you email me a small sample dataset? (10-20 obs)

best regards,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile
 
 
Posted: 10 March 2014 06:27 AM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  18
Joined  2011-11-16

Hi Joost
Thank you for your help. I found another approach to deal with the problem, that is, proc mixed. In the Chapter 8, Random coefficient model, there is good example for the problem. I used following program:
%macro a;
%do x=2002 %to 2012;
proc mixed data=a&x covtest cl;
  class dm;
  model ta=ocf/solution;
  random int ocf / type=un subject=dm solution G Gcorr;
  ods output solutionf=fixed solutionr=random;
run;

data vu;
  merge random(where=(effect=‘Intercept’) rename=(estimate=rint))
          random(where=(effect=‘lev’) rename=(estimate=rslope));
if _n_=1 then merge
        fixed(where=(effect=‘Intercept’) rename=(estimate=fint))
        fixed(where=(effect=‘lev’) rename=(estimate=fslope));
  taii=fint+rint;
  slope=fslope+rslope;
  keep dm fint fslope rint rslope tai slope;
run;

However, I am sure whether this procedure can deal with multiple independent variables. Would you like to give me some hint?

Thanks!
Kai

Profile
 
 
Posted: 11 March 2014 11:25 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Kai,

I did use the random effects model in a paper before, and I happen to have the book this example comes from (SAS for Mixed Models).

The SAS for Mixed Models didn’t help me get going, and online resources I found were much better for Stata than for SAS. For example, see http://www.bristol.ac.uk/cmm/learning/online-course/
So, these days I use Stata for random effects models.

But, using the code you have, I would think you can add independent variables in the model statement, for example, model ta = ocf var2 var3 var4 /solution. I am not 100% sure though.

best regards,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile