Reputation: 5
My specification is as follows:
Proc reg data = liqfworld;
Model x = y z ;
I need to perform this regression for every stock in my data set which has daily data and for every month. It is sorted by stock ID and dates in SAS format. Do I need a macro for performing repeated regressions on the same data set? My ultimate aim is to obtain the coefficient for y for each stock and each month into an output data set.
Grateful for any pointers. Thanks.
EDIT: To clarify, I need to do multiple not rolling regressions (each stock each month) and while the stock ID's are sorted in ascending order they are like this: 83, 94, 105 etc.
Upvotes: 0
Views: 999
Reputation: 9569
As your dataset is already sorted in the right order, you should be able to do this using by-group processing, without using a macro. If you don't already have a month variable, you will need to first create one from your existing date variable. I'd suggest using a view to do this.
Then you should be able to do this like so:
Proc reg data = liqfworld;
Model x = y z ;
/*More statements within the proc reg as needed*/
by stock month;
run;
Upvotes: 1