HELP WITH THIS!
Create a temporary SAS data set called birds from this data set:
A Typical -0.255
A Odd -0.324
B Typical -0.213
B Odd -0.185
C Typical -0.190
C Odd -0.299
D Typical -0.185
D Odd -0.144
E Typical -0.045
E Odd -0.027
F Typical -0.025
F Odd -0.039
G Typical -0.015
G Odd -0.264
H Typical 0.003
H Odd -0.077
I Typical 0.015
I Odd -0.017
J Typical 0.020
J Odd -0.169
K Typical 0.023
K Odd -0.096
L Typical 0.040
L Odd -0.330
M Typical 0.040
M Odd -0.346
N Typical 0.050
N Odd -0.191
O Typical 0.055
O Odd -0.128
P Typical 0.058
P Odd -0.182
How do I use this 'birds' data set to prepare it for a paired data analysis??
How do I use the TTEST procedure to compare the mean yellowness of the odd and typical feathers?
Try this:
data Birds;
length Group $7;
input ID $ Group Value;
datalines;
A Typical -0.255
A Odd -0.324
B Typical -0.213
B Odd -0.185
C Typical -0.190
C Odd -0.299
D Typical -0.185
D Odd -0.144
E Typical -0.045
E Odd -0.027
F Typical -0.025
F Odd -0.039
G Typical -0.015
G Odd -0.264
H Typical 0.003
H Odd -0.077
I Typical 0.015
I Odd -0.017
J Typical 0.020
J Odd -0.169
K Typical 0.023
K Odd -0.096
L Typical 0.040
L Odd -0.330
M Typical 0.040
M Odd -0.346
N Typical 0.050
N Odd -0.191
O Typical 0.055
O Odd -0.128
P Typical 0.058
P Odd -0.182
;
/* transpose from Long to Wide */
proc transpose data=Birds out=BirdsWide(rename=(COL1=Typical COL2=Odd));
by Id;
run;
proc ttest data=BirdsWide;
paired Typical*Odd;
run;
Is the file give to you like that or is it a CSV, TXT or Excel file to import?
How to import a data set - VIDEO
https://video.sas.com/detail/videos/sas-analytics-u/video/4664327156001/reading-and-generating-csv-f...
How to read directly via CARDS
https://stats.idre.ucla.edu/sas/modules/inputting-data-into-sas/
How to do a Paired T-Test
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/statug/statug_code_tteex03.htm
It seems like you'll need to wrangle your data as well a bit, so instructions on how to that are here. Look at the PROC TTEST example first to see how they structured their data for a paired test.
https://stats.idre.ucla.edu/sas/modules/how-to-reshape-data-long-to-wide-using-proc-transpose/
@mpc5 wrote:
HELP WITH THIS!
Create a temporary SAS data set called birds from this data set:
A Typical -0.255
A Odd -0.324
B Typical -0.213
B Odd -0.185
C Typical -0.190
C Odd -0.299
D Typical -0.185
D Odd -0.144
E Typical -0.045
E Odd -0.027
F Typical -0.025
F Odd -0.039
G Typical -0.015
G Odd -0.264
H Typical 0.003
H Odd -0.077
I Typical 0.015
I Odd -0.017
J Typical 0.020
J Odd -0.169
K Typical 0.023
K Odd -0.096
L Typical 0.040
L Odd -0.330
M Typical 0.040
M Odd -0.346
N Typical 0.050
N Odd -0.191
O Typical 0.055
O Odd -0.128
P Typical 0.058
P Odd -0.182
How do I use this 'birds' data set to prepare it for a paired data analysis??
How do I use the TTEST procedure to compare the mean yellowness of the odd and typical feathers?
@mpc5 wrote:
HELP WITH THIS!
Create a temporary SAS data set called birds from this data set:
A Typical -0.255
A Odd -0.324
B Typical -0.213
B Odd -0.185
C Typical -0.190
C Odd -0.299
D Typical -0.185
D Odd -0.144
E Typical -0.045
E Odd -0.027
F Typical -0.025
F Odd -0.039
G Typical -0.015
G Odd -0.264
H Typical 0.003
H Odd -0.077
I Typical 0.015
I Odd -0.017
J Typical 0.020
J Odd -0.169
K Typical 0.023
K Odd -0.096
L Typical 0.040
L Odd -0.330
M Typical 0.040
M Odd -0.346
N Typical 0.050
N Odd -0.191
O Typical 0.055
O Odd -0.128
P Typical 0.058
P Odd -0.182
How do I use this 'birds' data set to prepare it for a paired data analysis??
How do I use the TTEST procedure to compare the mean yellowness of the odd and typical feathers?
What are the variable names? Paired on what?
How do we know which variable holds "yellownesss"? You don't say. Such details matter.
variable is bird-feather-yellowness measure
Try this:
data Birds;
length Group $7;
input ID $ Group Value;
datalines;
A Typical -0.255
A Odd -0.324
B Typical -0.213
B Odd -0.185
C Typical -0.190
C Odd -0.299
D Typical -0.185
D Odd -0.144
E Typical -0.045
E Odd -0.027
F Typical -0.025
F Odd -0.039
G Typical -0.015
G Odd -0.264
H Typical 0.003
H Odd -0.077
I Typical 0.015
I Odd -0.017
J Typical 0.020
J Odd -0.169
K Typical 0.023
K Odd -0.096
L Typical 0.040
L Odd -0.330
M Typical 0.040
M Odd -0.346
N Typical 0.050
N Odd -0.191
O Typical 0.055
O Odd -0.128
P Typical 0.058
P Odd -0.182
;
/* transpose from Long to Wide */
proc transpose data=Birds out=BirdsWide(rename=(COL1=Typical COL2=Odd));
by Id;
run;
proc ttest data=BirdsWide;
paired Typical*Odd;
run;
Assuming the letters A, B, ... represent individuals, then you have the two values for each individual on separate lines of the data. As noted in the "Student's t-test: two dependent (paired) samples" item in the list of Frequently Asked-for Statistics (FASTats) in the Important Links section of the Statistical Procedures Community page, you can do a paired t-test in PROC UNIVARIATE by analyzing the difference of the paired values and testing that the mean difference is zero. The following computes the difference for each individual and then analyzes it in PROC UNIVARIATE. The test is in the "Tests for Location" table.
data a;
input id $ type $ y;
retain ty;
if type="Typical" then ty=y;
else diff=ty-y;
if diff ne . then output;
datalines;
A Typical -0.255
A Odd -0.324
B Typical -0.213
B Odd -0.185
C Typical -0.190
C Odd -0.299
D Typical -0.185
D Odd -0.144
E Typical -0.045
E Odd -0.027
F Typical -0.025
F Odd -0.039
G Typical -0.015
G Odd -0.264
H Typical 0.003
H Odd -0.077
I Typical 0.015
I Odd -0.017
J Typical 0.020
J Odd -0.169
K Typical 0.023
K Odd -0.096
L Typical 0.040
L Odd -0.330
M Typical 0.040
M Odd -0.346
N Typical 0.050
N Odd -0.191
O Typical 0.055
O Odd -0.128
P Typical 0.058
P Odd -0.182
;
proc univariate;
var diff;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.