BookmarkSubscribeRSS Feed
Songchan
Calcite | Level 5

Hello there,

 

I'm trying to use proc reg to estimate capm model, i've sorted the data by some conditions (permno date), but the codes didn't work,  the log says Interactivity disabled with By processing, can anybody help me with that problem?

proc reg noprint data=aa03 outest=capm;
      model exret=mkt_rf / sse ;
	  by permno date;
run;
8 REPLIES 8
PGStats
Opal | Level 21

"Interactivity disabled with By processing" is an informative Note, not an error at all.

PG
mkeintz
PROC Star

Proc REG, like all (I think) proc's that accept the quit statement is an "interactive" module.  I.e. you could enter:

 

  proc reg data=mydata;

    var y x1 x2 x3;

    model y=x1 x2;

    run;

 

Then you could examine the results, and spontaneously choose another model (using any vars in the VARS statement):

   model y= x1 x3;

   run;

 

The data wouldn't be reread, because proc reg stored the SSCP for all 4 variables, so any models among those variables could be estimated.  Also, for large datasets, I suspect the first model would take much longer that later models.

 

You wouldn't get out of proc reg until you issue a "quit:" statement, or start a new PROC.

 

But a BY statement would mean that proc reg would have to create an SSCP matrix for each by group, and I suspect that the 2nd SSCP replaces the first in memory, the 3rd replaces the 2nd, etc.  If that's the case, then you couldn't "interactively" enter the second model, because the only sscp available would be for the last by group.

 

All this means is that there's no changing the proc reg in mid-stream.

 

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Songchan
Calcite | Level 5

Hi, thanking for replying.

How could I fix that problem, because when i open the temp work, all my independent variables are zero, and dependent variables are -1.

 

songchan

mkeintz
PROC Star

I just notice your PROC REG code includes:

 

   BY PERMNO DATE;

 

suggesting you are using CRSP data, which has one observation per permno/date.  No regression possible. 

 

Since you want a Capital Asset Pricing Model estate, which is usually applied to a single stock, or each to a portfolio, you probably should use:

 

   BY PERMNO;

 

 

   

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Songchan
Calcite | Level 5

Hi,

 

I did what you suggested, but the result shows that my exret=-1, what that means?

 

Thank you,

Songchan

Songchan
Calcite | Level 5

By the way, my data was sorted into ten groups, i want to run regression in every rank, so i wrote 

 

by permno myrank,

 

but result shows that exret=0, and numbers of regressors in model were very small (eg. 0.105..) as well as numbers of parameters in model were.

 

Kind regards,

Songchan

mkeintz
PROC Star
  1. If exret=0 and if exret is the dependent variable, then your model specification (" model exret=mkt_rf / sse ;")  is not the problem.  Rather it is how you calculated exret before submitting it to the model.
  2. You're using "by permno myrank".  Does that mean you are dividing all the observations for each permno into 10 groups?  I can't see why you would do that.  Usually financial researchers divide the stocks into 10 deciles, ie. each permno is assigned to a single decile (myrank in your case).  If that's what you did, then "by permno myrank" would generate the same set of results as "by permno", because MYRANK would be a constant within each PERMNO group.

 

Why don't you focus on doing the work you need with 1 permno, just to make sure you have the proper process.  Then do it for 10 PERMNO's, 1 in each decile, using a BY statement.

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Songchan
Calcite | Level 5

Hi, I was replicating momentum strategy, i.e. divide all stocks into ten deciles, and calculate capm alpha for each decile. So i need ten alphas in total eventually.

 

Songchan

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 Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1520 views
  • 1 like
  • 3 in conversation