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

Hi Everyone,

 

I would like to perform a t-test on the following CAR to see whether they are significantly different to zero.

 

yearCAR_11
19951.5786
1996-1.8834
199710.2719
199924.2477
200032.1328
200135.7089
200223.5392
20032.0316
20055.8985
200620.3305
200718.4754
200849.5314
200953.0031
201129.6018
201340.2564
201416.6888

 

Can anybody please help? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Like this?

 

data have;
input year CAR_11;
datalines;
1995 1.5786
1996 -1.8834
1997 10.2719
1999 24.2477
2000 32.1328
2001 35.7089
2002 23.5392
2003 2.0316
2005 5.8985
2006 20.3305
2007 18.4754
2008 49.5314
2009 53.0031
2011 29.6018
2013 40.2564
2014 16.6888
;

proc ttest data=have h0=0 sides=2 alpha=0.05;
   var CAR_11;
run;

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Like this?

 

data have;
input year CAR_11;
datalines;
1995 1.5786
1996 -1.8834
1997 10.2719
1999 24.2477
2000 32.1328
2001 35.7089
2002 23.5392
2003 2.0316
2005 5.8985
2006 20.3305
2007 18.4754
2008 49.5314
2009 53.0031
2011 29.6018
2013 40.2564
2014 16.6888
;

proc ttest data=have h0=0 sides=2 alpha=0.05;
   var CAR_11;
run;
Ksharp
Super User

Since t-test is for two levels variable, and you don't have CLASS variable. I would use PROC UNIVARIATE.

 

data have;
input year CAR_11;
datalines;
1995 1.5786
1996 -1.8834
1997 10.2719
1999 24.2477
2000 32.1328
2001 35.7089
2002 23.5392
2003 2.0316
2005 5.8985
2006 20.3305
2007 18.4754
2008 49.5314
2009 53.0031
2011 29.6018
2013 40.2564
2014 16.6888
;
proc univariate data=have;
var car_11;
run;

 

 

 

位置检验: Mu0=0
检验 	统计量 	p 值
Student t 	t 	5.380997 	Pr > |t| 	<.0001
符号 	M 	7 	Pr >= |M| 	0.0005
符号秩 	S 	66 	Pr >= |S| 	<.0001
ballardw
Super User

@Ksharp


@Ksharp wrote:

Since t-test is for two levels variable, and you don't have CLASS variable. I would use PROC UNIVARIATE.

 

data have;
input year CAR_11;
datalines;
1995 1.5786
1996 -1.8834
1997 10.2719
1999 24.2477
2000 32.1328
2001 35.7089
2002 23.5392
2003 2.0316
2005 5.8985
2006 20.3305
2007 18.4754
2008 49.5314
2009 53.0031
2011 29.6018
2013 40.2564
2014 16.6888
;
proc univariate data=have;
var car_11;
run;

 

 

 

位置检验: Mu0=0
检验 	统计量 	p 值
Student t 	t 	5.380997 	Pr > |t| 	<.0001
符号 	M 	7 	Pr >= |M| 	0.0005
符号秩 	S 	66 	Pr >= |S| 	<.0001

I see your example output with an oriental font for some text. Is that what you saw before pasting or are we getting a forum artifact of some sort?

 

           Tests for Location: Mu0=0

Test           -Statistic-    -----p Value------

Student's t    t  5.380997    Pr > |t|    <.0001
Sign           M         7    Pr >= |M|   0.0005
Signed Rank    S        66    Pr >= |S|   <.0001


Ksharp
Super User

Yeah. We are getting the same result.

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
  • 4 replies
  • 1350 views
  • 3 likes
  • 4 in conversation