This is the code:
data robot;
infile 'C:\Users\paul\Downloads\Robot.dat' dlm=',';
input HumT 1-5 HybT 7-11;
run;
proc univariate data= robot normal;
qqplot HumT /normal (mu=est sigma=est);
by HumT;
run;
proc ttest data=robot sides=2 alpha=0.05 h0=0;
class HumT;
var HybT;
run;
The error:
ERROR: The CLASS variable has more than two levels.
The data:
185.4 180.4 .889 .997
146.3 248.5 .791 .959
174.4 185.5 .866 .821
184.9 216.4 .888 .914
240.0 269.3 .916 .973
253.8 249.6 .923 .925
238.8 282.0 .894 .912
263.5 315.9 .934 .965
Your classification variable should have values of Human and Hybrid to compare the mean score for throughput and quality.
Please see:
data have; input HumT HybT HumQ HybQ; datalines; 185.4 180.4 .889 .997 146.3 248.5 .791 .959 174.4 185.5 .866 .821 184.9 216.4 .888 .914 240.0 269.3 .916 .973 253.8 249.6 .923 .925 238.8 282.0 .894 .912 263.5 315.9 .934 .965 ; run; data need; set have; length type $6.; Type = 'Human'; Throughput = Humt; Quality = HumQ; output; Type = 'Hybrid'; Throughput = HybT; Quality = HybQ; output; keep type Throughput Quality; run; proc ttest data=need; class type; var Throughput Quality; run;
By design, a t-test compares two groups. That has nothing to do with SAS, it's just what a t-test does. So your CLASS variable within PROC TTEST should only take on two values.
What are you trying to accomplish, given that you have a data st with many values not two?
I'm trying to compare if humans and hybrid differ for
| Columns |
Human throughput | 1-5 |
hybrid throughput | 7-11 |
Human quality | 13-16 |
Hybrid quality | 18-21 |
I believe you will need to structure your data differently for that. For example, you could read it in this way:
data robot;
infile 'C:\Users\paul\Downloads\Robot.dat' dlm=',';
idnum = _n_;
category='Hybrid';
input throughput 7-11 quality 18-21 @ ;
output;
category='Human';
input throughput 1-5 quality 13-16;
output;
run;
185.4 180.4 .889 .997
146.3 248.5 .791 .959
174.4 185.5 .866 .821
184.9 216.4 .888 .914
240.0 269.3 .916 .973
253.8 249.6 .923 .925
238.8 282.0 .894 .912
263.5 315.9 .934 .965
;
It's not clear whether you would need idnum later on, so I included it. It lets you match up the human vs. hybrid observations.
Your classification variable should have values of Human and Hybrid to compare the mean score for throughput and quality.
Please see:
data have; input HumT HybT HumQ HybQ; datalines; 185.4 180.4 .889 .997 146.3 248.5 .791 .959 174.4 185.5 .866 .821 184.9 216.4 .888 .914 240.0 269.3 .916 .973 253.8 249.6 .923 .925 238.8 282.0 .894 .912 263.5 315.9 .934 .965 ; run; data need; set have; length type $6.; Type = 'Human'; Throughput = Humt; Quality = HumQ; output; Type = 'Hybrid'; Throughput = HybT; Quality = HybQ; output; keep type Throughput Quality; run; proc ttest data=need; class type; var Throughput Quality; run;
it worked, Thank you!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.