BookmarkSubscribeRSS Feed
AaronJ
Obsidian | Level 7

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

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@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

 

--
Paige Miller
AaronJ
Obsidian | Level 7

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2186 views
  • 0 likes
  • 2 in conversation