- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Okay, this is my first post, I am new to this SAS stuff. This is a required course for my major and I am not really good at it. I was hoping you guys could help me out.
I am stuck on the first problem coding part. I can't seem to get the chi squared test to work. It would be greatly appreciated if you could help me. This is my code that isn't correct obviously:
proc format;
value $EvaluationOfInstructor 'E'= 'Excellent' 'G'='Good' 'A'='Average' 'P'='Poor';
title GPA of the Student vs Evaluation of the Instructor;
data mylib.Project2GPA;
input EvaluationOfInstructor $ Below Between Above;
format EvaluationOfInstructor $EvaluationOfInstructor.;
datalines;
E 18 33 37
G 17 27 43
A 21 31 23
P 25 14 11
;
run;
proc freq data=mylib.project2gpa2;
tables EvaluationOfInstructor*GPAofStudent / chisq measures;
run;
data mylib.project2gpa2;
set mylib.project2gpa;
label
Below = 'Below 2.5'
Between = '2.5 to 3.5'
Above = 'Above 3.5';
run;
data mylib.project2gpa3;
set mylib.project2gpa2;
label
Below = 'GPAofStudent'
Between = 'GPAofStudent'
Above = 'GPAofStudent';
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your code shows that you have mastered many important techniques already.
The key point you are missing is that the columns Below, Between and Above all represent the same variable (number of students) in different classes (of GPA). SAS procedures expect classes to be represented by class variables.
In the example below, I rearranged the data in columns Evaluation, GPA, and NbStudents. That's what proc FREQ is expecting.
proc format;
value $Evaluation
'E'='Excellent'
'G'='Good'
'A'='Average'
'P'='Poor';
run;
title "GPA of the Student vs Evaluation of the Instructor";
data Project2GPA;
length GPA $10 Evaluation $1;
input Evaluation $ @;
do GPA = 'Below 2.5', '2.5 to 3.5', 'Above 3.5';
input nbStudents @;
output;
end;
label
GPA="GPA of the Student"
Evaluation="Evaluation given to Instructor";
format Evaluation $Evaluation.;
datalines;
E 18 33 37
G 17 27 43
A 21 31 23
P 25 14 11
;
proc freq data=Project2GPA;
tables GPA*Evaluation / chisq;
weight nbStudents;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your code shows that you have mastered many important techniques already.
The key point you are missing is that the columns Below, Between and Above all represent the same variable (number of students) in different classes (of GPA). SAS procedures expect classes to be represented by class variables.
In the example below, I rearranged the data in columns Evaluation, GPA, and NbStudents. That's what proc FREQ is expecting.
proc format;
value $Evaluation
'E'='Excellent'
'G'='Good'
'A'='Average'
'P'='Poor';
run;
title "GPA of the Student vs Evaluation of the Instructor";
data Project2GPA;
length GPA $10 Evaluation $1;
input Evaluation $ @;
do GPA = 'Below 2.5', '2.5 to 3.5', 'Above 3.5';
input nbStudents @;
output;
end;
label
GPA="GPA of the Student"
Evaluation="Evaluation given to Instructor";
format Evaluation $Evaluation.;
datalines;
E 18 33 37
G 17 27 43
A 21 31 23
P 25 14 11
;
proc freq data=Project2GPA;
tables GPA*Evaluation / chisq;
weight nbStudents;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content