SAS Programming

DATA Step, Macro, Functions and more
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?

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 3264 views
  • 0 likes
  • 3 in conversation