BookmarkSubscribeRSS Feed
ralphbenno
Fluorite | Level 6

I want to test rate of  "t"  between age 4 and 5

 

proc means data=project mean ;
class sex age ;
var rate  ;

where age in (4 5) & sex in ("t" );
run;

 

"this code shows me the mean for "t" for age 4 and age 5

then I use the ttest  then I get error   did not run


proc ttest data = Project;
class age & sex ;
var rate age;
where  age in (4 5) & sex in ("t");
run;
quit;

run;

 

help help

4 REPLIES 4
ralphbenno
Fluorite | Level 6

sorry the code I used is this

proc means data=project mean ;
class sex age ;
var rate  ;

where age in (4 5) & sex in ("t" );
run;
proc ttest data = Project;
class sex age;
var rate ;
where  age in (4 5) & sex in ("t");
run;
quit;

 

the ttest did not work  prob with "sex" in class

run;

Reeza
Super User

Your title says PROC GLM but you're running PROC TTEST. Which type of test are you trying to run?

If you have a single CLASS variable either procedure gives you the same result. PROC GLM can handle multiple CLASS variables, but unfortunately PROC TTEST cannot. If you need two iterations, you'll have to run it twice. 

 


@ralphbenno wrote:

sorry the code I used is this

proc means data=project mean ;
class sex age ;
var rate  ;

where age in (4 5) & sex in ("t" );
run;
proc ttest data = Project;
class sex age;
var rate ;
where  age in (4 5) & sex in ("t");
run;
quit;

 

the ttest did not work  prob with "sex" in class

run;


 

 

ralphbenno
Fluorite | Level 6

sorry for the confusion

I want to do a t test using multiple class for the column and row

do I use

proc glm

class column, row

var data

 

 

is it right?

PaigeMiller
Diamond | Level 26

It would be very helpful if you provided (a portion of) your data via SAS data step code, and not in any other format.

 

In any event, the general outline of what you want to do is:

 

proc glm data=whatever;
    class x1 x2;
    model y = x1 x2 /* the interaction is optional */ x1*x2;
run;
quit;

 

--
Paige Miller

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2308 views
  • 0 likes
  • 3 in conversation