Programming the statistical procedures from SAS

obtain regression parameters by year

Reply
Occasional Contributor
Posts: 19

obtain regression parameters by year

[ Edited ]

I am running regression based on year i.e. each year would have a different set of coefficients. I would like to obtain a dataset that contains all coefficients per year as well as other stats such as Standard Error, T-value, R-squared etc. My regression code is :

proc reg data=input;
by year;
model Y=X1 X2 X3;
run;

My desired output is: 

year      alpha        beta1        beta2        beta3      R-Squared       t-stat_beta1       t-stat_beta2
2000     aaaa         xxx            yyy            zzz     rrrr              tttttt            ttttttt
2001     aaaa         xxx            yyy            zzz     rrrr              ttttt             tttttt
2002     aaaa         xxx            yyy            zzz     rrrr              ttttt             ttttttt
2003     aaaa         xxx            yyy            zzz     rrrr              ttttt             tttttt
.............
..........

 Thanks!

Super Contributor
Posts: 340

Re: obtain regression parameters by year

[ Edited ]
Posted in reply to ducman1611

Use

proc reg data=input outest=prms; * outEST !;
Occasional Contributor
Posts: 19

Re: obtain regression parameters by year

Posted in reply to user24feb

Thanks, I found out that OUTEST option right after posting the question. I have modified my question slightly.

Super Contributor
Posts: 340

Re: obtain regression parameters by year

Posted in reply to ducman1611

Use "ODS Trace On/Off" to check the ODS output and use "ODS Output" to get FitStatistics & ParameterEstimates.

SAS Super FREQ
Posts: 3,752

Re: obtain regression parameters by year

Posted in reply to ducman1611

See the article "ODS OUTPUT: Store any statistic created by any SAS procedure". The article has an example with PROC REG. The article uses the FitStatistics table, but you can substitute the ParameterEstimates table.

 

To find out the names of ODS tables, see the article "Find the ODS table names produced by any SAS procedure"

Ask a Question
Discussion stats
  • 4 replies
  • 106 views
  • 0 likes
  • 3 in conversation