BookmarkSubscribeRSS Feed
Ahmad
Calcite | Level 5

Hi i am estimating a  dummy panel regression to remove seasonality.

The equation goes something like this

Y = intercept + b mon + b2 tue + b3 wed + b4 thrsday + e

Now i want to calculate a variable which would be intercept+ e

i am using       proc reg  with a "by" variable

how to extract only the intercept and residual as a seperate data set.

I know how to extract residual , but extracting intercept is very tricky . By using outest command it gives me a very jumbled data set with alot of other observations too.

Is there any efficient way???

Thanks in advance for helping

9 REPLIES 9
Ahmad
Calcite | Level 5

kindly help me on this need help urgently, sorry for bugging

PGStats
Opal | Level 21

It is quite straitforward to combine OUTEST= and OUT= datasets :

proc reg data=myData outest=myParms;
by myByVar;
model Y = mon tue wed thrsday;
output out=myRes r=resid;
run;

proc sql;
create table noSeason as
select R.myByVar, P.intercept + R.resid as Yp
from myParms as P inner join myRes as R on P.myByVar=R.myByVar
where P._TYPE_="PARMS";
quit;

PG

PG
Ahmad
Calcite | Level 5

Dear there is one little problem, all the out put tables delete the date variable and i want to include the date variable, is there any remedie for that.

Kindly reply as soon as you can . Really appreciate your help

Thanking you in anticipation

PGStats
Opal | Level 21

How is your date variable related to your other variables, especially to your BY variable(s)?

PG
Ahmad
Calcite | Level 5

it is a panel data basically, for 500 stocks , daily data over 7 years. so my by variable is the stock name, which is to say o am estimating regression for every stock seperately,

i managed to get the desired result by manipulating the code you provided , kindly check if i have done it right or if there is a more efficient way kindly suggest that

proc sql;

create table noSeason1 as

select R.codneg, P.intercept + R.resid as Yp ,date

from myres as R inner join Myparms as P on R.codneg=P.codneg

where P._TYPE_="PARMS";

quit;

Ahmad
Calcite | Level 5

where codneg is the stock name variable, and rest is all the same as you suggested

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 2739 views
  • 2 likes
  • 2 in conversation