BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Xinhui
Obsidian | Level 7

Hi there

I used following code: 

proc means data=master_1;
Var r;
by t;
OUTPUT out = final;
RUN;

I got mean std; 

I'm wondering how can I get t value and P in this case. What code should I use? 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@Xinhui wrote:

T is a veriable ”time" 

t has value 1,2,3,.....18,

R is the return,

I have 500 firms' data in the sample. 

I want to get T-statistic  and P vlue for returns, based on different groups of samples by t, T=1,2....18.

 


I say again: to have a P-value you have to conduct a statistical test. So what exact statistical test is your P-value supposed to reflect? Do you want to test that R is not 0? Is greater than 10? Less than 100? That the value of R is different at T=1 compared to T=2?

 

You can get a t-value p-value related to testing if the variable = 0 with this in proc means:

proc means data=sashelp.class mean std t probt;
  class sex;
  var height;
run;

If you need to test that the hypothesized value of the mean is something besides 0  you'll need to go to a different procedure. Which gets back to what do you want to test?

View solution in original post

7 REPLIES 7
ballardw
Super User

You can get a T value by requesting the T statistic. (Confusing as you have a variable named T);

A P value requires a test. What test do want to run?

Xinhui
Obsidian | Level 7

T is a veriable ”time" 

t has value 1,2,3,.....18,

R is the return,

I have 500 firms' data in the sample. 

I want to get T-statistic  and P vlue for returns, based on different groups of samples by t, T=1,2....18.

 

ballardw
Super User

@Xinhui wrote:

T is a veriable ”time" 

t has value 1,2,3,.....18,

R is the return,

I have 500 firms' data in the sample. 

I want to get T-statistic  and P vlue for returns, based on different groups of samples by t, T=1,2....18.

 


I say again: to have a P-value you have to conduct a statistical test. So what exact statistical test is your P-value supposed to reflect? Do you want to test that R is not 0? Is greater than 10? Less than 100? That the value of R is different at T=1 compared to T=2?

 

You can get a t-value p-value related to testing if the variable = 0 with this in proc means:

proc means data=sashelp.class mean std t probt;
  class sex;
  var height;
run;

If you need to test that the hypothesized value of the mean is something besides 0  you'll need to go to a different procedure. Which gets back to what do you want to test?

Xinhui
Obsidian | Level 7

my hypothsis is 

h0: r=0;

h1: r not equal to 0;

 

Reeza
Super User
Then you can use PROC Univariate as designed.
See the different statistics and keywords and definitions here:
https://documentation.sas.com/?docsetId=proc&docsetTarget=p0v0y1on1hbxukn0zqgsp5ky8hc0.htm&docsetVer...

You want PROBT for a two tailed p-value.
Xinhui
Obsidian | Level 7

I got what I want 

Thank you very much

Reeza
Super User
What's the hypothesis you're testing?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 3741 views
  • 0 likes
  • 3 in conversation