SAS Class Presentation4

SAS Class Presentation4 - Statistical Analysis Software An...

Info iconThis preview shows pages 1–14. 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

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: Statistical Analysis Software An Overview Chapter 7 DATA Step Programming Section 7.1 Reading SAS Data Sets and Creating Variables Objectives – Create a SAS data set using another SAS data set as input. – Create SAS variables. – Use operators and SAS functions to manipulate data values. – Control which variables are included in a SAS data set. Create a temporary SAS data set named onboard from the permanent SAS data named ia.dfwlax and create a variable that represents the total passengers on board. Sum FirstClass and Economy values to compute Total . New Variable Reading a SAS Data Set Flight Date Dest FirstClass Economy 439 14955 LAX 20 137 921 14955 DFW 20 131 114 14956 LAX 15 170 Total 157 151 185 SAS date values ia.dfwlax • To create a SAS data set using a SAS data set as input , you must use a – DATA statement to start a DATA step and name the SAS data set being created (output data set: onboard ) – SET statement to identify the SAS data set being read ( input data set: ia.dfwlax ). Reading a SAS Data Set To create a variable , you must use an assignment statement to add the values of the variables FirstClass and Economy and assign the sum to the variable Total . • By default, the SET statement reads all of the – observations from the input SAS data set – variables from the input SAS data set. General form of a DATA step: Reading a SAS Data Set DATA output- SAS-data-set ; SET input- SAS-data-set ; additional SAS statements RUN; • An assignment statement – evaluates an expression – assigns the resulting value to a variable. General form of an assignment statement: Assignment Statements variable=expression; Operators are symbols that request arithmetic calculations SAS functions. Operands are variable names constants. An expression contains operands and operators that form a set of instructions that produce a value. SAS Expressions • Selected operators for basic arithmetic calculations in an assignment statement: Operator Action Example Priority + Addition Sum=x+y; III - Subtraction Diff=x-y; III * Multiplication Mult=x*y; II / Division Divide=x/y; II ** Exponentiation Raise=x**y; I - Negative prefix Negative=-x; I Using Operators Flight Date Dest FirstClass Economy . . . PDV Compiling the DATA Step libname ia ' SAS-data-library '; data onboard; set ia.dfwlax; Total=FirstClass+Economy; run; ... c07s1d1 Flight Date Dest FirstClass Economy Total . . . . PDV Compiling the DATA Step libname ia ' SAS-data-library '; data onboard; set ia.dfwlax; Total=FirstClass+Economy; run; ... c07s1d1 Flight Date Dest FirstClass Economy 439 12/11/00 LAX 20 137 921 12/11/00 DFW 20 131 114 12/12/00 LAX 15 170 Flight Date Dest FirstClass Economy Total . . . ....
View Full Document

This note was uploaded on 07/15/2011 for the course ECO 2023 taught by Professor Mr.raza during the Summer '10 term at FAU.

Page1 / 195

SAS Class Presentation4 - Statistical Analysis Software An...

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

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