Statistical Analysis for Education and Psychology Researchers

(Jeff_L) #1

was then re-entered and saved as child2.dat. Both ASCII data sets as entered are shown
below:


Data:child1.dat Data:child2.dat
001 07 0 1 1 001 07 0 1 1
002 09 1 9 1 002 09 1 9 1
003. 1 1 2 003. 1 1 2
004 10 0 1 9 004 11 0 1 9
005 07 1 1 6 005 07 1 1 6
006 09 1 1 3 006 09 1 1 3
007 08 0 1 1 007 08 0 1 3
008 07 1 1 1 008 07 1 1 1
009 10 1. 1 009 10 1. 1
010 11 1 2 1 010 11 1 2 1

To use a SAS procedure simply add the appropriate procedure to the SAS programme
(colloquially termed a SAS job) after the DATA step, for example,


data child2;
infile ‘a:child2.dat’;
input caseid 1–3 ageyrs 5–6 sex 8 ses 10 raven 12;
proc compare data=child1 compare=child2;
run;

A SAS programme that uses the procedure PROC COMPARE is presented in Figure 3.3.
The PROC COMPARE statement is used here to check that the two data sets, child1.dat
and child2.dat, are the same.


0001 options nodate;
0002 data child1;
0003 infile ‘a:child1.dat’;
0004 input caseid 1–3 ageyrs 5–6 sex 8
ses 10 raven 12;
0005
0006 data child2;
0007 infile ‘a:child2.dat’;
0008 input caseid 1–3 ageyrs 5–6 sex 8
ses 10 raven 12;
0009
0010 proc compare data=child1
compare=child2 transpose nolistequal
nosummary;
0011 title ‘PROC COMPARE OUTPUT’;
0012 run;

Figure 3.3: Example SAS programme


using PROC COMPARE


Each line of the example programme in Figure 3.3 is explained in the following
section. Line numbers have been added to this programme to aid explanation, these


Statistical analysis for education and psychology researchers 40
Free download pdf