- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am attempting to run a two-sample test with a data set imported from an excel sheet. There are two values of data, Before and After, that I am attempting to compare. When I input the information, I am receiving a log error "ERROR: The CLASS variable has more than two levels." Can someone support with what is missing?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps you are trying to test (using PROC TTEST) if the mean of Before is equal to the mean of AFTER. Is that what you want to do?
If so, your data set needs to be arranged like this (where the first row is the variable names). You obviously don't have this and so PROC TTEST can't run on your data.
WHEN SCORE BEFORE 22.2 BEFORE 23.9 AFTER 15.0 AFTER 21.7 AFTER 19.8
In this case
proc ttest data=have;
var score;
class when;
run;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you have more than two levels, then PROC TTEST will not work, and produces the error you show. PROC TTEST will only work if variable AFTER has exactly two levels. Please look at your SAS data set named WORK.COFFEE to see what is variable AFTER.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Let's not talk about Excel. This has everything to do with the SAS data set you have named WORK.COFFEE. Please look at it with your own eyes. Levels is another way of saying distinct values.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Vcalderon233 wrote:
I have looked at it in the data set, which again, is the source of my confusion. When I look at the SAS data set, the variable listed are 2. Where can I look in the data set to find distinct values
You count the distinct values in the variable named AFTER. You can do this visually.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps you are trying to test (using PROC TTEST) if the mean of Before is equal to the mean of AFTER. Is that what you want to do?
If so, your data set needs to be arranged like this (where the first row is the variable names). You obviously don't have this and so PROC TTEST can't run on your data.
WHEN SCORE BEFORE 22.2 BEFORE 23.9 AFTER 15.0 AFTER 21.7 AFTER 19.8
In this case
proc ttest data=have;
var score;
class when;
run;
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for providing this clarification. This appeared to resolve the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps (I'm guessing) what you really want is a Paired T-test. Is that what you want? Then you need a different layout of the data, possibly even the layout you have already. See this example
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am guessing you have two columns (variables - Before & After) with some kind of measurement as the values.
You need to have two columns (variables - for example Stage with values "Before" and "After" & Measurements - with the measurement values)
Here is an example with sashelp.class data:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content