BookmarkSubscribeRSS Feed
Student_B
Calcite | Level 5

Suppose we have variables ID X Y and our data looks like this:

003 42 34

004 54 65

005 33 46

. . .

I want to perform a paired and unpaired t-test on the X and Y variables without a data step (this is part of the question).. I understand

how to do a paired, but how can you do an unpaired t-test, as in X and Y are just different sets of sample data? es

2 REPLIES 2
PGStats
Opal | Level 21

Proc Transpose...; by id; var x y; run; ? Then proc ttest...; class _NAME_; var col1; run;

PG
Reeza
Super User

You need to transform your data so that you have your variables stacked and a new variable that identifies the groups:

ID Var Value

1 X 1

1 Y 2

1 X 3

1 Y 4

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1458 views
  • 0 likes
  • 3 in conversation