turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Ttest ERROR: The CLASS variable does not have two...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-26-2017 01:07 PM

I am running PROC Ttest withe following code:

PROC IMPORT DATAFILE=FILEREF

DBMS=XLSX

OUT=WORK.IMPORT;

GETNAMES=YES;

RUN;

data AllEvents;

set import;

RUN;

if Phase=1;

logVWC=log(VWC);

proc ttest cochran ci=equal umpu;

Class Phase;

Var logVWC;

run;

SAS gives me the following error message: ERROR: The CLASS variable does not have two levels.

In the Excel file that is imported in the first statement, Phase variables are 1 and 2, so it definitely has 2 and only 2 levels.

any insights would be appreciated

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-26-2017 01:21 PM

AaronJ wrote:

I am running PROC Ttest withe following code:

PROC IMPORT DATAFILE=FILEREF

DBMS=XLSX

OUT=WORK.IMPORT;

GETNAMES=YES;

RUN;

data AllEvents;

set import;RUN;

if Phase=1;

logVWC=log(VWC);proc ttest cochran ci=equal umpu;

Class Phase;

Var logVWC;

run;

SAS gives me the following error message: ERROR: The CLASS variable does not have two levels.

In the Excel file that is imported in the first statement, Phase variables are 1 and 2, so it definitely has 2 and only 2 levels.

any insights would be appreciated

SAS doesn't care about the Excel file that is imported. SAS only cares about WORK.ALLEVENTS. What is in WORK.ALLEVENTS, how many levels does PHASE have in WORK.ALLEVENTS?

Well, I think I know the answer because in your code you have

if Phase=1;

which means that the variable PHASE in WORK.ALLEVENTS has only one level ... it only has PHASE=1

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-26-2017 01:27 PM

thanks, i think you and i caught that at the same time. I tried to delete this post, but SAS told me i didn't have sufficient privileges.

Again, thanks for pointing out the error.