10-04-2015 09:00 PM
I have an excel file with notes of all students from Class1 and Class2.
And I want to find if there is a differance between average of Class1 and the average of Class2 students using SAS9.3?
10-04-2015 10:48 PM
proc ttest data=myData; class class; var mark; run;
10-05-2015 10:08 AM
First you will need to read in your excel file. Take a look at the following examples if you have SAS/ACCESS to PC File Formats:
33486 - Getting Your Data into SAS
see Section 2.17
If you are not licensed for SAS/ACCESS to PC File Formats you can use DDE(Dynamic Data Exchange) to read from excel into SAS:
26146 - Write, save, close, open and read Excel files using DDE
Or create a csv(comma separated variable) file from excel and read it in as illustrated in example 2 of the following SAS Note:
24656 - Use PROC IMPORT to read a CSV, TAB or delimited file
Next you will need to get your data into a form as PGStats described, have a variable for each class that represents the grade, say c1 and c2.
There are a number of approaches you can take to determine if the averages of the variables are different...proc ttest, proc means, data step. Here is the data step approach:
data grades; input c1 c2; cards; 100 99 95 100 87 100 94 80 91 89 ;;;; data average; set grades nobs=nobs end=end; c1tot+c1; c2tot+c2; if end then do; c1aver=round(c1tot/nobs,.1); c2aver=round(c2tot/nobs,.1); if c1aver=c2aver then same='Y'; else same='N'; output; end; keep c1aver c2aver same; run;