BookmarkSubscribeRSS Feed
econfkw
Calcite | Level 5

I have a panel data with issuecd (stock id) and date (time). I'm doing regression by issuecd, computing Newey West standard error. 'Outest' can output the coefficients. How can I output the p value and t statistic? Below is my code:

proc model data=kse9;
by issuecd;
parms b0 b1 b2 b3;
log_vol=b0+b1*D+b2*log_AVE_vol+b3*log_AVE_mvol;
fit log_vol/gmm kernel=(BART,8,0) outest=temp;
instruments D log_AVE_vol log_AVE_mvol;
run;

Also, How can I suppress the output. Since I have >1000 stocks, a message pops up like: window is full. Then I have to choose to File, Save, clear window without saving.... I don't know how to deal with it.

BTW, how to use outparms?

Thanks

7 REPLIES 7
Reeza
Super User

Check out this paper on using the ODS facility

You can also close the odd output once you set it up to go to tables, using odd listing close so your output window doesn't get full.

http://www.lexjansen.com/pharmasug/2012/TF/PharmaSUG-2012-TF22-SAS.pdf

econfkw
Calcite | Level 5

thanks for your suggestion. I use ods all the times.

Anyway, 'outest' only outputs coefficients, how can I output p value and t statistic? by outest, I have

column 1   column 2  column 3

issuecd        date        coefficients.

I need a column 4 - p value and column 5- t statistics.

thanks

Reeza
Super User

If they're in the output you get from SAS and there isn't a default option mentioned in the docs (didn't check and I'm not familiar with proc model) then you'll need to capture the ods table thats contains the p-value and t statistics which you can then merge with the outset table or capture the ODS table that gets displayed.

The paper suggested goes over how to do that.

You probably need to add in the last line as below before run.

proc model data=kse9;
by issuecd;
parms b0 b1 b2 b3;
log_vol=b0+b1*D+b2*log_AVE_vol+b3*log_AVE_mvol;
fit log_vol/gmm kernel=(BART,8,0) outest=temp;
instruments D log_AVE_vol log_AVE_mvol;

ods output ParameterEstimates=sample1;

run;

econfkw
Calcite | Level 5

let me clarify the code.

There are 1000 stocks (issuecd). I'm running regression for each stocks. There will be coefficients, p value and t for each regression.

That's why I need

column 1   column 2  column 3        column 4      column 5

issuecd        date        coefficients.     P                   T

Then by proc mean, I can find the average of coefficients, P and t.

for unknown reason, when I try

ods output ParameterEstimates=sample1;

no output is created. But I didn't similar things before. The output is similar to the default table but in different format. you can't computer average coefficients.  I need a TABLE like above.

Reeza
Super User

SAS won't give it to you by default. You'll have to merge/manipulate the tables it does give you.

Post a more detailed example of what you're looking for, with numbers specifically around the coefficients.

econfkw
Calcite | Level 5

Actually, 'ods output ParameterEstimates' does work. I also need R square. Why doesn't the following code work?

proc model data=kse9;
by issuecd;
parms b0 b1 b2 b3;
log_vol=b0+b1*D+b2*log_AVE_vol+b3*log_AVE_mvol;
fit log_vol/gmm kernel=(BART,8,0) outest=temp;
instruments D log_AVE_vol log_AVE_mvol;

ods output ParameterEstimates=sample1 GoodnessOfFit=sample2 RSquare=sample3;

run;

Sample2 and sample3 are not created.

Thanks

Reeza
Super User

The names ParameterEstimates is a specific table name, you need to determine what the table name is for the data you're interested in. The paper above goes through how to do that using odd trace.

ods trace on;

your code

ods trace off;

Check the log and match the table name you want with the data in the output. ResidSummary contains the Rsquared value.

proc model data=kse9;
by issuecd;
parms b0 b1 b2 b3;
log_vol=b0+b1*D+b2*log_AVE_vol+b3*log_AVE_mvol;
fit log_vol/gmm kernel=(BART,8,0) outest=temp;
instruments D log_AVE_vol log_AVE_mvol;

ods output ParameterEstimates=sample1 residsummary=rsquared ;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 5307 views
  • 0 likes
  • 2 in conversation