Please find attached a file (XrA 16-05.xls) on which I have tried 2 sample ttest with the below mentioned code
ods noproctitle;
ods graphics / imagemap=on;
/* t test */
proc ttest data=WORK.SYMPTOMS sides=2 h0=0 cochran plots(only
showh0)=(summaryPlot intervalPlot qqplot);
class Home;
var Outside;
run;
For both the variables in the sheet if I choose it as class (as one by one case) the log shows
ERROR: The CLASS variable has more than two levels.
Also I am not getting the T value and p value, QQ plot etc
Can some one please help as I faced the same situation with another file as well.
Hello, @gauravv0103 welcome to the SAS Communities.
ERROR: The CLASS variable has more than two levels.
Your CLASS variable named HOME has more than two levels, and so you cannot perform PROC TTEST on it. You need to use a variable that has exactly two levels (or perform your t-tests in PROC GLM).
Thanks Mr. Miller for your input and suggestion.
Just wanted to understand what do we mean regarding levels over here, It is a generic numeric variable we are getting the solution we when we run it through either excel data analysis or use Minitab. Then why it is not possible with Proc ttest.
Request if you could throw light on it.
Mr. Miller, As advised by you I have used Proc GLM for the same but the results are not matching with excel data analysis.
I have used the following procedure, please let me know if it is the right way to do it.
ods graphics on;
proc glm data=wives plot=diagnostics;
class Home;
model Outside = Home;
run;
ods graphics off;
Also attached is the outcome of GLM ( it is giving F Value) in PDF format and excel data analysis (It is giving T Value). How can we conclude that both results in same analysis.
Regards
@gauravv0103 wrote:
Just wanted to understand what do we mean regarding levels over here, It is a generic numeric variable we are getting the solution we when we run it through either excel data analysis or use Minitab. Then why it is not possible with Proc ttest.
Numeric variables are almost never placed in CLASS statements in PROC TTEST. The CLASS statement should contain the name of a category variable that contains two levels. "Generic numeric" variables probably ought to go in the VAR statement.
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.