08.02.2013 Views

Biostatistics for Animal Science

Biostatistics for Animal Science

Biostatistics for Animal Science

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

12 <strong>Biostatistics</strong> <strong>for</strong> <strong>Animal</strong> <strong>Science</strong><br />

To find the median the observations are sorted from smallest to the largest:<br />

220 230 250 250 260 260 260 260 260 270 270 280 280 280 290 290<br />

300 320 320 320<br />

Since n = 20 is an even number, the median is the average of n /2 = 10 th and (n+2) /2 = 11 th<br />

observations when the data are sorted. The values of those observations are 270 and 270,<br />

respectively, and their average is 270, thus, the median is 270 kg. The mode is 260 kg<br />

because this is the observation with the highest frequency.<br />

1.5 SAS Example<br />

Descriptive statistics <strong>for</strong> the example set of weights of calves are calculated using SAS<br />

software. For a more detailed explanation how to use SAS, we recommend the exhaustive<br />

SAS literature, part of which is included in the list of literature at the end of this book. This<br />

SAS program consists of two parts: 1) the DATA step, which is used <strong>for</strong> entry and<br />

trans<strong>for</strong>mation of data, 2) and the PROC step, which defines the procedure(s) <strong>for</strong> data<br />

analysis. SAS has three basic windows: a Program window (PGM) in which the program is<br />

written, an Output window (OUT) in which the user can see the results, and LOG window<br />

in which the user can view details regarding program execution or error messages.<br />

Returning to the example of weights of 20 calves:<br />

SAS program:<br />

DATA calves;<br />

INPUT weight @@;<br />

DATALINES;<br />

260 260 230 280 290 280 260 270 260 300<br />

280 290 260 250 270 320 320 250 320 220<br />

;<br />

PROC MEANS DATA = calves N MEAN MIN MAX VAR STD CV ;<br />

VAR weight;<br />

RUN;<br />

Explanation: The SAS statements will be written with capital letters to highlight them,<br />

although it is not generally mandatory, i.e. the program does not distinguish between small<br />

letters and capitals. Names that user assigns to variables, data files, etc., will be written with<br />

small letters. In this program the DATA statement defines the name of the file that contains<br />

data. Here, calves is the name of the file. The INPUT statement defines the name(s) of the<br />

variable, and the DATALINES statement indicates that data are on the following lines.<br />

Here, the name of the variable is weight. SAS needs data in columns, <strong>for</strong> example,<br />

INPUT weight;<br />

DATALINES;<br />

260<br />

260<br />

…<br />

220<br />

;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!