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.

Slides:



Advertisements
Similar presentations
HTML I. HTML Hypertext mark-up language. Uses tags to identify elements of a page so that a browser such as Internet explorer can render the page on a.
Advertisements

Summary Statistics/Simple Graphs in SAS/EXCEL/JMP.
The SAS ® System Additional Information on Statistical Analysis Programming.
The INFILE Statement Reading files into SAS from an outside source: A Very Useful Tool!
Introduction to SAS Programming Christina L. Ughrin Statistical Software Consulting Some notes pulled from SAS Programming I: Essentials Training.
Module 4.2 File management 1. Contents Introduction The file manager Files – the basic unit of storage The need to organise Glossary 2.
Alford Academy Business Education and Computing1 Advanced Higher Computing Based on Heriot-Watt University Scholar Materials File Handling.
1 An Introduction to IBM SPSS PSY450 Experimental Psychology Dr. Dwight Hennessy.
Access Tutorial 1 Creating a Database
Pet Fish and High Cholesterol in the WHI OS: An Analysis Example Joe Larson 5 / 6 / 09.
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.
Creating SAS® Data Sets
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
FIRST COURSE Access Tutorial 1 Creating a Database.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
CIS 451: HTML Frames Adapted from materials developed by Dr. Soe (updated January, 2009)
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
1 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
® Microsoft Access 2010 Tutorial 1 Creating a Database.
Introduction to SAS. What is SAS? SAS originally stood for “Statistical Analysis System”. SAS is a computer software system that provides all the tools.
PREPARING DATA FOR STATISTICAL ANALYSIS Data Cleaning Data Cleaning Dataset Preparation Dataset Preparation Documentation Documentation 9 September 2008.
1 Experimental Statistics - week 2 Review: 2-sample t-tests paired t-tests Thursday: Meet in 15 Clements!! Bring Cody and Smith book.
BMTRY 789 Introduction to SAS Programming Lecturer: Annie N. Simpson, MSc.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
EPIB 698C Lecture 2 Notes Instructor: Raul Cruz 2/14/11 1.
Bringing Data into SAS From Menu: –File –Import Data –Spreadsheet example first Pick file by browsing Select Library and Member (we will talk about this.
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
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)
Introduction to SAS Essentials Mastering SAS for Data Analytics
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Laboratory 1. Introduction to SAS u Statistical Analysis System u Package for –data entry –data manipulation –data storage –data analysis –reporting.
Chapter 22: Using Best Practices 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
BMTRY 789 Lecture 11: Debugging Readings – Chapter 10 (3 rd Ed) from “The Little SAS Book” Lab Problems – None Homework Due – None Final Project Presentations.
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.
SAS Basics. Windows Program Editor Write/edit all your statements here. Log Watch this for any errors in program as it runs. Output Will automatically.
Chapter 4 concerns various SAS procedures (PROCs). Every PROC operates on: –the most recently created dataset –all the observations –all the appropriate.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
1 Statistical Software Programming. STAT 6360 –Statistical Software Programming Data Input in SAS Many ways to get your data into SAS: –Through data entry.
Chapter 1: Overview of SAS System Basic Concepts of SAS System.
Shelcat Scottish Health Libraries Catalogue Training guide, March 2009.
SAS Basics. Windows Program Editor Write/edit all your statement here.
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.
Click here to begin HOW TO FIND RESEARCH THESIS HOW TO FIND RESEARCH THESIS.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
Use the SET statement to: –create an exact copy of a SAS dataset –modify an existing SAS dataset by creating new variables, subsetting (using a subsetting.
HOW TO FIND RESEARCH PROJECT PAPER HOW TO FIND RESEARCH PROJECT PAPER Click here to begin.
Lesson 2 Topic - Reading in data Programs 1 and 2 in course notes –Chapter 2 (Little SAS Book)
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
SAS Programming Training Instructor:Greg Grandits TA: Textbooks:The Little SAS Book, 5th Edition Applied Statistics and the SAS Programming Language, 5.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
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.
Lesson 2 Topic - Reading raw data into SAS
Instructor: Raul Cruz-Cano 7/9/2012
Chapter 2: Getting Data into SAS
SAS Programming Introduction to SAS.
Chapter 1: Introduction to SAS
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
Introduction to DATA Step Programming: SAS Basics II
Eviews Tutorial for Labor Economics Lei Lei
CHAPTER 17 The Report Writer Module
Introduction to SAS Essentials Mastering SAS for Data Analytics
Presentation transcript:

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 window (see p.32) –or use SAS/FSP (Full Screen Product)... maybe later Enter data into text files and then read it into SAS data sets text file = ASCII = “raw” data. Convert other software’s datasets into SAS datasets - use DDE (Dynamic Data Exchange), especially for Excel. Import wizard can also work here…especially on.csv files - maybe the best way? Read other software’s datasets directly into SAS - one example is a transport file - can also use Import Wizard here…

Raw data Data directly in the stream of the SAS program is called “raw”. Use the datalines; or cards; statements. First line of data must immediately follow the datalines; statement. See our first SAS program… Data in an external raw data file. Use the infile statement to point SAS to the location of the file containing the data (i.e., give the path) Do the example program in section 2.4. Look at the Example Code file on the website…

Look at Dr. Padgett’s dataset… Use column and/or list input as needed (see section 2.5) to read in the data... print it out and get a plot of total mass against plant height... But first... let’s look at these two types of input in some detail...

READING RAW DATA Use INPUT statement - very flexible... –gives variable name, type and position –can read data with different types of separators LIST INPUT - different variables’ values are separated by at least one space - see section 2.5 –must read all data values in the record –no embedded spaces in data values –character data values at most 8 characters –all missing data values indicated by a. (period) –no special formatting of data values

Use the example code from the textbook on my website.. use it to save time and to give you examples to work with... e.g., I’ll copy the example program in section 2.5 below: * Create a SAS data set named toads; * Read the data file ToadJump.dat using list input; * DF Modified the program with DATALINES instead of INFILE...; DATA toads; *INFILE 'c:\MyRawData\ToadJump.dat'; INPUT ToadName $ Weight Jump1 Jump2 Jump3; DATALINES; Lucky Spot Tubs Hop Noisy Winner ; * Print the data to make sure the file was read correctly; PROC PRINT DATA = toads; TITLE 'SAS Data Set Toads'; RUN;

Column Input - requires that the data values for different variables be lined up in columns –spaces not required between variable values –missing values can be left blank –character data can have embedded blanks –specific variables can be read and others can be skipped –change the INPUT statement to include the column numbers where the named variables can be found - this requires exact counting of columns in the data listing INPUT VisitingTeam $ 1-20 ConcessionSales BleacherSales OurHits TheirHits OurRuns TheirRuns 38-40; SEE EXAMPLE CODE ON PAGE 41...USE A “COUNTER” IN THE DATA, AND THEN IGNORE IT IN THE INPUT STATEMENT

PROC CONTENTS proc contents data= your dataset name ; gives lots of information about the SAS datasets you have created (either temporary or permanent ones {more later about these}). Try it on the example datasets we’ve been working on...

Permanent SAS datasets Permanent SAS datasets are formed in your SAS programs by so naming them in the DATA name_here ; statement... They are saved permanently with all the variable names and formats, etc. that you created when you ran the DATA step... We will show more about these later...

Some paths of interest are: – C:\Windows\Desktop\filename (Older Windows) – C:\Documents and Settings\username\Desktop\filename (XP) – A:\filename (floppy disk) – E:\filename (flashdrive)

Homework Read sections Use both list and column inputs on the example datasets... Try to save your data as permanent SAS datasets - go back and review section 1.11