Programming the statistical procedures from SAS

output p value and t statistics

Reply
Contributor
Posts: 23

output p value and t statistics

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

Grand Advisor
Posts: 16,875

Re: output p value and t statistics

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

Contributor
Posts: 23

Re: output p value and t statistics

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

Grand Advisor
Posts: 16,875

Re: output p value and t statistics

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;

Contributor
Posts: 23

Re: output p value and t statistics

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.

Grand Advisor
Posts: 16,875

Re: output p value and t statistics

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.

Contributor
Posts: 23

Re: output p value and t statistics

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

Grand Advisor
Posts: 16,875

Re: output p value and t statistics

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;

Ask a Question
Discussion stats
  • 7 replies
  • 1071 views
  • 0 likes
  • 2 in conversation