Introduction to SAS®.

Slides:



Advertisements
Similar presentations
The INFILE Statement Reading files into SAS from an outside source: A Very Useful Tool!
Advertisements

Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
SAS Programming:File Merging and Manipulation. Reading External Files (review) data barf; * create the dataset BARF; infile ’s:\mysas\Table7.1'; * open.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Statistics in Science  Introducing SAS ® software Acknowlegements to David Williams Caroline Brophy.
Today: Run SAS programs on Saturn (UNIX tutorial) Runs SAS programs on the PC.
Categorical Data Analysis using SAS. 2 List the components of a SAS program. Open an existing SAS program and run it. Discuss the Chi Square Test of Independence.
SAS ® Regression Essentials. 2 List the components of a SAS program. Open an existing SAS program and run it. Objectives.
NonParametric Statistics using SAS. 2 List the components of a SAS program. Open an existing SAS program and run it. Objectives.
Data Transformation Data cleaning. Importing Data Reading data from external formats Libname/Infile/Input for text form data Proc Import for Excel/Access.
EPLS Lab Software Orientation SAS. Orientation Overview Background Getting Started SAS Windows.
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
Into to SAS ®. 2 List the components of a SAS program. Open an existing SAS program and run it. Objectives.
Introduction to SAS Lecture 2 Brian Healy.
Creating SAS® Data Sets
SAS ® ANOVA Essentials. 2 List the components of a SAS program. Open an existing SAS program and run it. Objectives.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
1 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
Chapter 20 Creating Multiple Observations from a Single Record Objectives Create multiple observations from a single record containing repeating blocks.
Introduction to SAS. What is SAS? SAS originally stood for “Statistical Analysis System”. SAS is a computer software system that provides all the tools.
1 Experimental Statistics - week 2 Review: 2-sample t-tests paired t-tests Thursday: Meet in 15 Clements!! Bring Cody and Smith book.
Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview.
EPIB 698C Lecture 2 Notes Instructor: Raul Cruz 2/14/11 1.
BMTRY 789 Lecture 2 SAS Syntax, entering raw data, etc. Lecturer: Annie N. Simpson, MSc. Readings – Chapters 1, 2, 12, & 13 Lab Problems 1.1, 1.2, 1.3,
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.
Lesson 2 Topic - Reading in data Chapter 2 (Little SAS Book)
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting MySQL – Inserting Data.
How to start using SAS Tina Tian. The topics An overview of the SAS system Reading raw data/ create SAS data set Combining SAS data sets & Match merging.
Here’s another problem (see section 2.13 on page 54). A file contains two different types of records (say A’s and B’s) and we only want to read in the.
Using Text Files in Excel File I/O Methods. Working With Text Files A file can be accessed in any of three ways: –Sequential access: By far the most common.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
ISQS 6347, Data & Text Mining 1 ISQS 6339, Data Management & Business Intelligence Data Preparation for Analytics Using SAS Zhangxi Lin Texas Tech University.
1 Statistical Software Programming. STAT 6360 –Statistical Software Programming Data Input in SAS Many ways to get your data into SAS: –Through data entry.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Chapter 1: Overview of SAS System Basic Concepts of SAS System.
How to start using SAS SARBAJIT MUKHERJEE. WHAT IS SAS? SAS stands for Statistical Analysis System. Useful for the following types of task: 1. Data entry,
Lecture 4 Ways to get data into SAS Some practice programming
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
Chapter 18 Reading Free-Format Data. 2 Objectives Read free-format data not recognized in fixed fields. Read free-format data separated by non-blank delimiters,
ISQS 6347, Data & Text Mining 1 ISQS 6339, Data Management & Business Intelligence Data Preparation for Analytics Using SAS Zhangxi Lin Texas Tech University.
Chapter 2 Getting Data into SAS Directly enter data into SAS data sets –use the ViewTable window. You can define columns (variables) with the Column Attributes.
Quick Test Professional 9.2. Testing Process Preparing to Record Recording Enhancing a Test Debugging Running the Test and Analyzing the Results Reporting.
Lesson 2 Topic - Reading in data Programs 1 and 2 in course notes –Chapter 2 (Little SAS Book)
SAS Programming Training Instructor:Greg Grandits TA: Textbooks:The Little SAS Book, 5th Edition Applied Statistics and the SAS Programming Language, 5.
Copyright 2009 The Little Engine That Could: Using EXCEL LIBNAME Engine Options to Enhance Data Transfers between SAS® and Microsoft® Excel Files William.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
SAS Programming Training
Lesson 2 Topic - Reading raw data into SAS
SAS Programming Training
Instructor: Raul Cruz-Cano 7/9/2012
Chapter 2: Getting Data into SAS
Introduction to Scripting
Two “identical” programs
SAS Workshop SAS Data Management Hun Myoung Park, Ph.D.
Instructor: Raul Cruz-Cano
Tamara Arenovich Tony Panzarella
Data Management – Audit Trail
Defining and Calling a Macro
Introduction to DATA Step Programming: SAS Basics II
SAS Programming Training
Outline READ DATA DATA STEPS MERGE DATA PROC IMPORT
SAS® Regression Essentials
Introduction to SAS Lecturer: Chu Bin Lin.
Introduction to SAS Essentials Mastering SAS for Data Analytics
Introduction to SAS Essentials Mastering SAS for Data Analytics
Presentation transcript:

Introduction to SAS®

Objectives List the components of a SAS program. Open an existing SAS program and run it.

SAS Programs A SAS program is a sequence of steps that the user submits for execution. Raw Data DATA steps are typically used to create SAS data sets. SAS Data Set DATA Step PROC Step Report SAS Data Set PROC steps are typically used to process SAS data sets (that is, generate reports and graphs, edit data, and sort data).

SAS Programs DATA Step PROC Steps DATA one; INPUT Name $ Gender $ Runtime Age Weight ; DATALINES; Donna F 8.17 42 68.15 Gracie F 8.63 38 81.87 Luanne F 8.65 43 85.84 Mimi F 8.92 50 70.87 Chris M 8.95 49 81.42 ; RUN; PROC PRINT DATA=one; PROC REG DATA=one; MODEL Runtime=Weight; DATA Step PROC Steps

SAS Windowing Environment Interactive windows enable you to interface with SAS.

Exercises Open the SAS program “example.sas.” Submit the program and examine the results. Files for today's class located at http://faculty.missouri.edu/baconr/sas/intro

Objectives Learn the two fundamental SAS syntax programming rules. Create a SAS dataset from a space delimited inline text file. Create a SAS dataset from a comma delimited inline text file. Create a SAS dataset from a comma delimited external text file. Reading an Excel file PROC IMPORT via Import Wizard

Fundamental SAS Syntax Rules SAS statements have these characteristics: usually begin with an identifying keyword always end with a semicolon data staff; input LastName $ FirstName $ JobTitle $ Salary; datalines; …insert text data here… run; proc print data=staff;

Example of a typical space delimited text file ‘space.txt’ Name Gender Runtime Age Weight Donna F 8.17 42 68.15 Gracie F 8.63 38 81.87 Luanne F 8.65 43 85.84 Mimi F 8.92 50 70.87 Chris M 8.95 49 81.42

Creating a SAS data set from a space delimited text file: The Data Step DATA one; INPUT Name $ Gender $ Runtime Age Weight; DATALINES; Donna F 8.17 42 68.15 Gracie F 8.63 38 81.87 Luanne F 8.65 43 85.84 Mimi F 8.92 50 70.87 Chris M 8.95 49 81.42 ; RUN; PROC PRINT DATA=one;

Example of a typical comma delimited text data set. ‘Comma.txt’ Name,Gender,Runtime,Age,Weight Donna,F,8.17,42,68.15 Gracie,F,8.63,38,81.87 Luanne,F,8.65,43,85.84 Mimi,F,8.92,50,70.87 Chris,M,8.95,49,81.42

Creating a SAS data set from a comma delimited text file: The Data Step DATA two; INFILE DATALINES DLM=',' DSD MISSOVER; INPUT Name $ Gender $ Runtime Age Weight; DATALINES; Donna,F,8.17,42,68.15 Gracie,F,8.63,38,81.87 Luanne,F,8.65,,85.84 Mimi,F,8.92,50 Chris,M,8.95,49,81.42 ; RUN; PROC PRINT DATA=two;

INFILE Options Option Description DLM= INFILE "raw-data-file" <DLM=> <DSD> <MISSOVER>; Option Description DLM= Specifies an alternate delimiter. DSD Sets the default delimiter to a comma, treats consecutive delimiters as missing values, and allows embedded delimiters when the data value is enclosed in quotation marks. MISSOVER Sets variables to missing if the end of the record is reached before finding values for all fields.

Creating a SAS data set from an external comma delimited text file: The Data Step DATA three; INFILE 'C:\USERS\BACONR\DESKTOP\comma.txt' DLM=',' DSD MISSOVER FIRSTOBS=2; INPUT Name $ Gender $ Runtime Age Weight; RUN; PROC PRINT DATA=three;

Example of a typical comma delimited text data set. ‘Comma.txt’ Name,Gender,Runtime,Age,Weight Donna,F,8.17,42,68.15 Gracie,F,8.63,38,81.87 Luanne,F,8.65,43,85.84 Mimi,F,8.92,50,70.87 Chris,M,8.95,49,81.42

Reading an Excel File Typical Excel file: ‘myexcel.xlsx’

Creating a SAS data set from an EXCEL file: PROC IMPORT via the SAS IMPORT WIZARD 32-bit SAS 64-bit SAS

Capturing the Syntax: PROC IMPORT via the SAS IMPORT WIZARD

Creating a SAS data set from an EXCEL FILE: PROC IMPORT via the IMPORT WIZARD 32-bit PROC IMPORT OUT= WORK.four DATAFILE= "C:\Users\baconr\Downloads\myexcel.xlsx" DBMS=EXCEL REPLACE; RANGE="comma$"; GETNAMES=YES; MIXED=NO; SCANTEXT=YES; USEDATE=YES; SCANTIME=YES; RUN; PROC PRINT DATA=four;