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.

Slides:



Advertisements
Similar presentations
How to Import an Excel File Using the SAS Import Wizard SAS 9 for Windows.
Advertisements

The SAS ® System Additional Information on Statistical Analysis Programming.
The INFILE Statement Reading files into SAS from an outside source: A Very Useful Tool!
Stata and logit recap. Topics Introduction to Stata – Files / directories – Stata syntax – Useful commands / functions Logistic regression analysis with.
Introduction to SAS Programming Christina L. Ughrin Statistical Software Consulting Some notes pulled from SAS Programming I: Essentials Training.
Statistics in Science  Introducing SAS ® software Acknowlegements to David Williams Caroline Brophy.
A Simple Guide to Using SPSS© for Windows
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.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 9 Processing the Data.
© Copyright 2012 by Pearson Education, Inc. All Rights Reserved. Chapter 13 Files and Exception Handling 1.
Aloha Aloha What you see: What the computer sees: binary number columns binary number columns
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
Don’t Import It! Setting Up a SAS Libname to an Excel Spreadsheet or Access Database… in 10 Seconds or Less! Kevin Druhan Wait Time Improvement Office.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
Introduction to Unix (CA263) File Processing. Guide to UNIX Using Linux, Third Edition 2 Objectives Explain UNIX and Linux file processing Use basic file.
General Programming Introduction to Computing Science and Programming I.
Intro to Statistics and SPSS. Mean (average) Median – the middle score (even number of scores or odd number of scores) Percent Rank (percentile) – calculates.
Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats Accessing Information Processing Information.
Text and Graphics September 26, Unit 3.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
EPIB 698C Lecture 2 Notes Instructor: Raul Cruz 2/14/11 1.
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
Colleague, Excel & Word Best of Friends Presented by: Joan Kaun & Yvonne Nelson College of the Rockies.
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,
Lesson 2 Topic - Reading in data Chapter 2 (Little SAS Book)
Introduction to SAS Essentials Mastering SAS for Data Analytics
CMPS 1371 Introduction to Computing for Engineers FILE Input / Output.
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
SAS: The last of the great mainframe stats packages STA431 Winter/Spring 2013.
Database Applications – Microsoft Access Lesson 1 Introduction 26 Slides in Presentation Updated 8/12.
Working With Files. Sources of Data Adding data to a spreadsheet can be done in several ways, including: – Type it in piece by piece – Read it from a.
Getting Started With Stata Session 1 Jim Anthony John Troost Department of Epidemiology Michigan State University.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
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.
Laboratory 1. Introduction to SAS u Statistical Analysis System u Package for –data entry –data manipulation –data storage –data analysis –reporting.
Python Mini-Course University of Oklahoma Department of Psychology Lesson 18 Using text files to share data with other programs 5/07/09 Python Mini-Course:
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.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
YET ANOTHER TIPS, TRICKS, TRAPS, TECHNIQUES PRESENTATION: A Random Selection of What I Learned From 15+ Years of SAS Programming John Pirnat Kaiser Permanente.
Files Tutor: You will need ….
Chapter 1: Overview of SAS System Basic Concepts of SAS System.
An Introduction Katherine Nicholas & Liqiong Fan.
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
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.
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.
Lesson 2 Topic - Reading in data Programs 1 and 2 in course notes –Chapter 2 (Little SAS Book)
1 Data Manipulation (with SQL) HRP223 – 2009 October 12, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
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.
DoD EA Dip Cse - NCW Export Macros
Fundamentals of Python: First Programs
What is Binary? Binary is a two-digit (Base-2) numerical system, which computers use to process and store data. The reason computers use the binary system.
Instructor: Raul Cruz-Cano 7/9/2012
Chapter 2: Getting Data into SAS
SAS Programming Introduction to SAS.
ECONOMETRICS ii – spring 2018
How to Import an Excel File
Chapter 1: Introduction to SAS
Instructor: Raul Cruz-Cano
Database Applications – Microsoft Access
funCTIONs and Data Import/Export
Python programming exercise
Retrieving numerical values.
Python 16 Mr. Husch.
Presentation transcript:

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 on the next slide Create file that does import Nothing happens! Meaning, you don’t see any results, but file is created –Look at import file that is created –Caution – need to worry about formats that are carried along during import. They may not be obvious!

Bringing Data into SAS Important Concepts in SAS –Permanent and Temporary datasets (tables) –Libraries Libname class “c:\data\class\fw893”; data species; infile "c:\data\class\fw893\fish_species.txt"; input species_code common $ family $ genus $ species $; run; data class.species; infile "c:\data\class\fw893\fish_species.txt"; input species_code common $ family $ genus $ species $; run; { { This creates a temporary table named species This creates a permanent table named species in the directory specified in the libname

ASCII files –May seem a bit harder than an Excel file, but more general –First need to examine structure of file so can import properly. I frequently use Notepad or similar simple text editor –Count columns, names of fields, etc. Bringing Data into SAS

Fish Species Table example: –Species Code column 1-2 –Common name column –Family column –Genus column –Species column Show SAS code Bringing Data into SAS

Important “Quirks” –Numeric fields can be imported without specifying column placement –Variables that are alphanumeric are followed by a dollar sign –If alphanumeric data do not have a space between them, AND text is 8 characters or less, you can import without specifying column placement. –Need to be careful if try to read beyond end of line by having too many fields (need to watch for ending fields that are empty) Bringing Data into SAS

Once you have a permanent dataset (table) created, you can read it in using the following syntax: Bringing Data into SAS Libname class “c:\data\class\fw893”; data class.species; infile "c:\data\class\fw893\fish_species.txt"; input species_code common $ family $ genus $ species $; run; data dummy; set class.species; run; You can think of the “DATA” step as meaning “create the following table” You can think of the “SET” command as meaning “use the following table”

In-class exercise/homework Import the data in sample_list.txt and print out the table in SAS Import the data in sample_list.xls files into SAS and print out the resulting table. How do they compare Try to read in the transect data set (which is a permanent data set) from the class drive, and print off this dataset. Note you will need to specify the correct library name.