Solved
Contributor
Posts: 43

# how to use R² from multiple regressions as a variable in another regression

hi i am estimating regressions for stock prices on monthly basis, i want to creat a timeseries variable of R² from each regression , How to do it????

Accepted Solutions
Solution
‎07-04-2012 09:37 PM
Posts: 5,536

## Re: how to use R² from multiple regressions as a variable in another regression

Like this :

proc reg data=have outest=want;

by myStock myWhatever;

model myPrice = myXvariable / rsquare;

run;

proc print data=want;

var myStock myWhatever _RSQ_;

run;

PG

PG

All Replies
Solution
‎07-04-2012 09:37 PM
Posts: 5,536

## Re: how to use R² from multiple regressions as a variable in another regression

Like this :

proc reg data=have outest=want;

by myStock myWhatever;

model myPrice = myXvariable / rsquare;

run;

proc print data=want;

var myStock myWhatever _RSQ_;

run;

PG

PG
Contributor
Posts: 43

## Re: how to use R² from multiple regressions as a variable in another regression

Thanks for the quick reply , i have another question how can i calculate weekly standard deviation from my daily price series and use it in a regression as a variable??

Thanks

Regards

Posts: 5,536

## Re: how to use R² from multiple regressions as a variable in another regression

If I get it right, what you want is something like (untested) :

proc sql;

create table myWstd as

select stock, intck("WEEK", '01JAN2000'd, myDate) as weekNo, std(price) as priceStd

from myData

group by stock, calculated weekNo;

and then regress priceStd on weekNo, by stock.

PG

PG
🔒 This topic is solved and locked.