Lecture 4 Working with Your Data

Lecture 4 Working with Your Data - I OWA S TATE U NIVERSITY...

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 Working with Your Data (Chapter 2 in the Little SAS Book) Animal Science 500 Lecture No. 4 September 9, 2010 I OWA S TATE U NIVERSITY Department of Animal Science Working with Your Data To this point we have identified 1. Many forms which data can stored and ultimately imported into SAS 1. Spreadsheets – Excel, Lotus, Quattro Pro, etc. 2. Databases – Access, SQL, others 3. Text files – from Word, WordPad, Notepad, others 4. Other fileformats 2. Many ways to import our data into SAS 1. Import wizard 2. Infile statement 3. Others Many options to use with the importing of the data, formatting the input data, etc . I OWA S TATE U NIVERSITY Department of Animal Science Modifying your Data ◆ Data step ■ read and modify data ■ create a new dataset ■ performs actions on rows ◆ Proc step ■ use an existing dataset ■ produce an output/results ■ performs actions on columns I OWA S TATE U NIVERSITY Department of Animal Science Modifying your Data ◆ Creating and redefining variables is straightforward in a SAS data step ■ variable = expression; ◆ Examples ■ Newvariable = constant; ■ Newvariable = oldvariable * constant; ■ Adjusted Backfat, growth rate, loin muscle area = predetermined equation 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...
View Full Document

This document was uploaded on 02/14/2012.

Page1 / 32

Lecture 4 Working with Your Data - I OWA S TATE U NIVERSITY...

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