Lecture 3 Getting Your Data into the SAS system

Lecture 3 Getting Your Data into the SAS system - I OWA S...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: I OWA S TATE U NIVERSITY Department of Animal Science I OWA S TATE U NIVERSITY Department of Animal Science Getting Your Data Into SAS (Chapter 2 in the Little SAS Book) Animal Science 500 Lecture No. 3 September 7, 2010 I OWA S TATE U NIVERSITY Department of Animal Science Arithmetic Operators Operation Symbol Example Result + addition Num + Num Example: 5 + 3 add two numbers together- subtraction Num - Num Example: 5 3 or can use two variables ending wt. beginning wt. subtract the value of 5 -3 * multiplication (table note 1) 2*y Always have to have * cannot use 2(y) or 2y multiply 2 by the value of Y / division var/5 or can use variable weight gain / days on test divide the value of VAR by 5 ** can also use the ^ exponentiation a**2 or a^2 raise A to the second power I OWA S TATE U NIVERSITY Department of Animal Science Comparison Operators Comparison operators set up a comparison, operation, or calculation with two variables, constants, or expressions within the dataset being used . If the comparison is true, the result is 1. If the comparison is false, the result is 0. Comparison operators can be expressed as symbols or with their mnemonic equivalents, which are shown in the following table: I OWA S TATE U NIVERSITY Department of Animal Science Comparison Operators Symbol Mnemonic Equivalent Definition Example = EQ equal to a=3 ^= NE not equal to (table note 1) a ne 3 = NE not equal to ~= NE not equal to > GT greater than num>5 < LT less than num<8 >= GE greater than or equal to (table note 2) sales>=300 <= LE less than or equal to (table note 3) sales<=100 IN equal to one of a list num in (3, 4, 5) I OWA S TATE U NIVERSITY Department of Animal Science Logical (Boolean) Operators and Expressions Symbol Mnemonic Equivalent Example & AND (a>b & c>d) | OR (a>b or c>d) ! OR OR NOT not(a>b) NOT ~ NOT Logical operators , also called Boolean operators , are usually used in expressions to link sequences of comparisons. I OWA S TATE U NIVERSITY Department of Animal Science Finding your data Most of the time your raw data files will be saved as external files 1. Text files Word, WordPerfect, Writer, etc. 2. Spreadsheets - Excel, Lotus, Quattro Pro, etc. 3. Other systems Unix, Open VMS, etc. I OWA S TATE U NIVERSITY Department of Animal Science Reading external files into SAS The files containing your stored data will typically be stored 1. On the hard drive of the computer that you will ultimately use to analyze the data with SAS 2. Stored externally USB memory stick (flash memory) External hard drive Must get your data from storage into SAS to conduct the analyses I OWA S TATE U NIVERSITY Department of Animal Science Reading external files into SAS Use the Infile statement within a DATA step Data mytrial; Infile c:\mydocument\trial.xls; Input statement (Input variable names Remember to put the $ for character variables....
View Full Document

This document was uploaded on 02/14/2012.

Page1 / 30

Lecture 3 Getting Your Data into the SAS system - I OWA S...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online