Hi Everyone,
I would like to perform a t-test on the following CAR to see whether they are significantly different to zero.
year | CAR_11 |
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 |
Can anybody please help? Thanks.
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;
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;
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
@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
Yeah. We are getting the same result.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.