Introduction to SAS Essentials Mastering SAS for Data Analytics

Slides:



Advertisements
Similar presentations
ITEC 1001 Tutorial 1 Using Common Features of Microsoft Office 2003.
Advertisements

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.
Tutorial 8: Developing an Excel Application
Word Lesson 1 Microsoft Word Basics
Microsoft Word 2010 Lesson 1: Introduction to Word.
Windows XP Basics OVERVIEW Next.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. How to Create Web Pages Using HTML Introduction.
© by Pearson Education, Inc. All Rights Reserved.
Today: Run SAS programs on Saturn (UNIX tutorial) Runs SAS programs on the PC.
1 An Introduction to IBM SPSS PSY450 Experimental Psychology Dr. Dwight Hennessy.
Using the Visual Basic Editor Visual Basic for Applications 1.
Welcome to the Exciting World of ! Lessons to familiarize yourself with.
XP Using Common Features of Microsoft Office Tutorial 1.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
CIS101 Introduction to Computing Week 06. Agenda Your questions Excel Exam during second hour Our status after the snow day Introduction to the Internet.
RIMS II Online Order and Delivery System Tutorial on Downloading and Viewing Multipliers.
If you are connected to the Internet, click and then click on the web page to experience an introduction to applications. The following lesson is about.
Lesson 46: Using Information From the Web copy and paste information from a Web site print a Web page download information from a Web site customize Web.
Creating a Web Page HTML, FrontPage, Word, Composer.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Section 6.1 Explain the development of operating systems Differentiate between operating systems Section 6.2 Demonstrate knowledge of basic GUI components.
 Using Microsoft Expression Web you can: › Create Web pages and Web sites › Set what you site will look like as you design it › Add text, images, multimedia.
A First Program Using C#
Internet Skills An Introduction to HTML Alan Noble Room 504 Tel: (44562 internal)
1 iSee Player Tutorial Using the Forest Biomass Accumulation Model as an Example ( Tutorial Developed by: (
Project 3 File, Document, Folder Management, Windows XP Explorer Windows XP Service Pack 2 Edition Comprehensive Concepts and Techniques.
XP New Perspectives on Introducing Microsoft Office XP Tutorial 1 1 Introducing Microsoft Office XP Tutorial 1.
1 Lesson 6 Exploring Microsoft Office 2007 Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
INTRODUCTION TO FRONTPAGE. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features Features  Starting Front Page Starting Front Page  Components.
1 Chapter 2 & Chapter 4 §Browsers. 2 Terms §Software §Program §Application.
Microsoft Office Illustrated Introductory, Premium Edition with Word 2003 Getting Started.
Getting Started with Application Software
CHAPTER 9 Introducing Microsoft Office Learning Objectives Start Office programs and explore common elements Use the Ribbon Work with files Use.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
CHAPTER 9 Introducing Microsoft Office Learning Objectives Start Office programs and explore common elements Use the Ribbon Work with files Use.
Tutorial 1: Browser Basics.
Math 3400 Computer Applications of Statistics Lecture 1 Introduction and SAS Overview.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lesson 1 Introduction.
Basic Computer and Word Functions, part 1 Read the information and use to answer the questions in the Basic Computer and Word Functions Study Guide.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 1 1 Microsoft Office FrontPage 2003 Tutorial 1 – Creating a Web Site.
OCC Network Drives  H:\  P:\ 
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
PowerTeacher with Web Grade Book Semester Classes School Year August 2012.
11/13/07 J. MooneCenter for Professional Development1 Office 2007 Changes At First Glance.
Introduction to SAS Essentials Mastering SAS for Data Analytics
An Introduction to Office  Office XP and Office 2007 look very different  This introduction should: ◦ Introduce you to some of the basic changes.
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
Basic Computer and Word Functions, part 1 Read the information and use to answer the questions in the Basic Computer and Word Functions Study Guide.
1 EPIB 698E Lecture 1 Notes Instructor: Raul Cruz 7/9/13.
I NTRODUCTION TO M ICROSOFT O FFICE W ORD A GENDA Interface- File Button v. Office Menu File Menu and the Office Button Toolbar Home Tab – Font,
By Felixberto Dominic B. Eruela.  Using a computer to create, edit, and print documents. Of all computer applications, word processing is the most common.
Computing Fundamentals Module Lesson 7 — The Windows Operating System Computer Literacy BASICS.
Chapter 1: Overview of SAS System Basic Concepts of SAS System.
Computer Literacy BASICS: A Comprehensive Guide to IC 3, 5 th Edition Lesson 3 Windows File Management 1 Morrison / Wells / Ruffolo.
Chapter 27 Getting “Web-ified” (Web Applications) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
1 Word Lesson 1 Microsoft Word Basics Microsoft Office 2010 Introductory Pasewark & Pasewark.
Microsoft Office 2008 for Mac – Illustrated Unit D: Getting Started with Safari.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
Creating Web Pages with Links, Images, and Embedded Style Sheets
1. Using word you can create the document and edit them later, as and when required,by adding more text, modifying the existing text, deleting/moving.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
Key Applications Module Lesson 12 — Word Essentials Computer Literacy BASICS.
C Copyright © 2009, Oracle. All rights reserved. Using SQL Developer.
SAS Programming Introduction to SAS.
Microsoft Word 2003 Illustrated Complete
Windows Internet Explorer 7-Illustrated Essentials
Chapter 1: Introduction to SAS
Presentation transcript:

Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward

Chapter 1: Getting Started SAS Essentials - Elliott & Woodward

LEARNING OBJECTIVES To be able to use the SAS® software program in a Windows environment To understand the basic information about getting data into SAS and running a SAS program. To be able to run a simple SAS program. SAS Essentials - Elliott & Woodward

The Statistics Software Landscape SAS – largest, highly used in corporate and university research settings, has several interfaces SPSS – IBM bought them recently – widely used in social sciences (and now more in business) – Quick to learn in menu mode STATA – Relatively new, command/code oriented JMP – a SAS product that is highly visual and menu driven R – a user supported programming language, free and expansive, but a larger learning curve EXCEL – has some statistical functions and procedures WINKS – Simple, low cost general use statistics program, with a special version for Time Series MINITAB – Used in a number of intro stat courses SAS Essentials - Elliott & Woodward

Introducing SAS SAS is a programming language that specializes in data analytics. There are several ways to use SAS – this book teaches you how to use SAS code, which provides the most flexibility. We’ll be using SAS in a Windows environment, although SAS is available on most platforms A brief tutorial on the University Edition is in the book’s appendix Also, information on using the Citrix SAS (Apps) version is included in the text SAS Essentials - Elliott & Woodward

Getting Started – Download Example Files Getting the data needed for the course Data files are available at http//:www.alanelliott.com/sas Choose one of two options to download files: OPTION 1 - Download self-extracting files (copies SAS files to your hard disk, default location is C:\SASDATA) Recommended. OPTION 2 – Download a zipped version of data files (You'll need a zip extractor such as WINZIP to extract files using this method.) SAS Essentials - Elliott & Woodward

1.1 Using SAS in A Windows Environment SAS runs on a number of computer platforms (operating systems) including mainframes and personal computers whose operating systems are UNIX, Mac OS X, Linux, or Windows. This book is based on using SAS in a Windows environment where you have the software installed on your local computer. The vast majority of the content in this book will apply to any SAS computer environment SAS Essentials - Elliott & Woodward

Creating a Folder for Storing Your SAS Files Install the data and SAS programming files in your (Windows) C:\SASDATA folder. We’ll be accessing SAS files from the C:\SASDATA folder on your computer Your Hard Disk C:\SASDATA SAS Program If you are using the University edition, consult Appendix E regarding the location of the data files. For other versions of SAS, see Table 1.1 on page 4 for information on accessing files. SAS Essentials - Elliott & Woodward

Understanding the SAS Interface LOG Window Explorer & Results Program Editor NOTE TABS SAS Essentials - Elliott & Woodward

SAS Editor Also called the Enhanced Editor or Windows Programming Editor (WPGM), this is the area where you write SAS code. It is like a simple word processor. When you open a previously saved SAS program, its contents will appear in this window. SAS code is stored in plain ASCII text, so files saved in the ASCII format from any other editor or word processor may be easily opened in this editor. You can also copy (or cut) text from another editor or word processor and paste it into the Editor window. SAS Essentials - Elliott & Woodward

SAS Log When you run a SAS program, a report detailing how (and if) the program ran, appears in the LOG window. Typically, when you run a SAS program, you will first look at the contents of the LOG window to see if there were any errors in the program. Errors appear in red. You should also look for warnings and other notes in the LOG Window to that tell you that some part of your program may not have run correctly. SAS Essentials - Elliott & Woodward

SAS Explorer/Results Window This window appears at the left of the screen and contains two tabs: The Results tab displays a tree listing of your output, making it easy to quickly scroll to any place in your output listing. The Explorer tab displays the available SAS libraries – these libraries are where SAS data files are stored. SAS Essentials - Elliott & Woodward

Graph Window If your SAS program creates graphic output, SAS will display a Graph window that contains the SAS graph. It is usually automatically displayed. If it does not appear click on the Graph tab to display this window. SAS Essentials - Elliott & Woodward

Results Viewer Beginning with SAS 9.3, SAS displays output from your SAS analysis in HTML format in the Results Viewer. We’ll discuss more about how to control this output in the section on Output Delivery System (ODS) SAS Essentials - Elliott & Woodward

Oops… What if you close one of these Windows? Reopen it by going to the View pull-down menu and select the windows you want to reopen SAS Essentials - Elliott & Woodward

1.2 Your First SAS Analysis In SAS, choose File/Open Program… and open the program named C:\SASDATA\First.SAS SAS Essentials - Elliott & Woodward

Note Sections in Code This section defines the data for the analysis This section defines an analysis SAS Essentials - Elliott & Woodward

Defining a Data Set We’ll discuss this more in detail later, but notice that this code defines data set named EMPLOYEES that consists of two variables GENDER and AGE. SAS Essentials - Elliott & Woodward

Requesting an Analysis The second section of the code requests an analysis. In this case, the requested analysis is called “MEANS” (which indicates simple statistics) and the CLASS (classification or grouping) of the data is request by GENDER. SAS Essentials - Elliott & Woodward

Run the code To tell SAS to run (Submit) this code, click on the “Running Man” icon or select Run/Submit SAS Essentials - Elliott & Woodward

Output Created, Results Window The output created by this simple program displays simple statistics for the numeric variables (AGE) in the data set – By Gender. This type output is HTML. SAS Essentials - Elliott & Woodward

What to do with output You can print from either window Save the output Copy and paste the results in Word, PowerPoint, etc. Later, we’ll see how to automatically output the analyses to .DOC, .PDF, etc SAS Essentials - Elliott & Woodward

Do Hands-On Example p 9 Make sure you are in the Editor window Open Second.SAS Add a line to the program. Run the program and observe the output SAS Essentials - Elliott & Woodward

Results SAS Essentials - Elliott & Woodward

3. Run the program and observe the output (in the Results Viewer). 1.3 How SAS Works 1. Define a data set in SAS using the DATA step (which begins with the key word DATA.) In this case, the data values are a part of the code (although it is not always the case.) The data values to be used in this analysis follow the keyword DATALINES. 2. Once you have a data set of values, you can tell SAS what analysis to perform using a procedure (PROC) statement In this case, the keywords PROC MEANS initiate the "MEANS" procedure. 3. Run the program and observe the output (in the Results Viewer). SAS Essentials - Elliott & Woodward

1.4 Tips and Tricks for Running SAS Within a SAS program, each statement begins with an identifying keyword (DATA, PROC, INPUT, DATALINES, RUN, etc.) and ends with a semicolon “;”. For example: DATA TEMP; PROC PRINT DATA=TEMP; RUN; All three lines start with a SAS keyword… SAS Essentials - Elliott & Woodward

SAS Tips continued… Statements can begin anywhere and end anywhere. Statements can continue over several lines, ends with semi‑colon. Several statements may be on the same line. Blanks, as many as you want but at least one, separating the components (words) in a SAS program statement. Case, (lower and upper) doesn’t matter in most SAS statements. Case does make a difference in data and quoted information. (such as M or m for “MALE” or “male”). SAS Essentials - Elliott & Woodward

SAS Tips Continued… The most common error in SAS programming is a misplaced (or missing) semicolon. A second common error is a missing RUN; statement. A third common error in a SAS program is the presence of unbalanced quotation marks. Look for errors in a program log from the top down. If program errors cause problems that result in SAS “freezing up” or not completing the steps in your program, a way to stop SAS from continuing to run is to press CTRL-Break and to select the “Cancel Submitted Statements” option. If you cannot resolve a problem within SAS, save your files, exit the SAS program, and restart. Make the structure of your SAS programs easy to read. SAS Essentials - Elliott & Woodward

Enhanced Editor Green - Comments appear in green. Dark Blue - Major SAS commands (also called “step- boundaries”) begin with the keyword in dark blue. Blue - Keywords that have special meaning as SAS commands appear in blue. Yellow highlight - Data are highlighted in yellow. Boundary Line - A section boundary line separates each step. SAS Essentials - Elliott & Woodward

SAS Function Keys (Defined) SAS command Result F2 RESHOW reshows window interrupted by system command F3 end; /*gsubmit buffer=default*/ submits SAS statements in clipboard F4 recall recalls current SAS code to editor F5 program (PGM) display SAS program editor window F6 log displays SAS log window F7 output displays SAS output window F8 zoom off;submit submits (runs) the current SAS program F9 KEYS displays keys window F10 Not defined   F11 command bar moves cursor to command bar F12 Not definEd SAS Essentials - Elliott & Woodward

Define a new F12 Key (page 13) Step 1: Select Tools, Options, and Keys. Step 2: Next to the blank F12 option enter this code: CLEAR LOG; ODSRESULTS; CLEAR; WPGM; (Press the Enter key to lock in the new command.) Step 3: Exit the Key Window and try out this function key by re-running one of the previous examples. With the output displayed on the screen, press F12. The output will be cleared, the log file information will be cleared and the editor window will be displayed still containing the current program code. Thus, this command allows you to quickly clear the log and output windows while keeping the program code. SAS Essentials - Elliott & Woodward

SAS Menus (Change depending on Window) File Menu - Used for opening and saving files, and for printing. Edit Menu - Used to copy, cut and paste text, as well as to find and replace text. View Menu - Allows you to go back and forth between viewing SAS editor, log and output windows. Tools - Allows you to open programs for graphic, image, and text editing, along with other options available to customize the program to your preferences. Run - Allows you to run (submit) a SAS program and also contains options for accessing remote SAS options. Solutions - Contains links to SAS programs that allow you to interactively design, select, and perform analyses. Window - Contains options found in most Windows program that allow you to choose display strategies for opened windows such as tiled, cascade, etc. Also allows you to select a particular window to open such as Log, Output, etc. Help - Contains options for the SAS Help System as well as online documentation. SAS Essentials - Elliott & Woodward

Common File Extensions SAS Code File (filename.sas): This is an ACSII text file and may be edited using the SAS Editor, Notepad, or any text editor that can read an ASCII file. SAS Log File (filename.log): This ASCII text file contains information such as errors, warnings, and data set details for a submitted SAS program. SAS Results File (filename.mht or filename.html): This file contains theweb-formatted output such as that displayed in the Results Viewer. HTML standsfor Hyper-Text Markup Language and is the common language of Internet web files. MHT is short for MHTML and stands for Microsoft (or MIME) Hypertext Archive file. It is a type of HTML file that contains the entire html-coded information in a single file (whereas HTML files may access external files for some components such as graphs.) SAS Essentials - Elliott & Woodward

More extensions SAS Data File (filename.sas7bdat): This file contains a SAS data set that includes variable names, labels, and the results of calculations you may have performed in a DATA step. You cannot open or read this file except in SAS or in a few other programs that can read SAS data files. Raw Data Files (filename.dat or filename.txt or filename.csv): These ASCII (text) files contain raw data that can be imported into SAS or edited in an editor such as Notepad. Excel File (filename.xls or filename.xlsx): The data in a Microsoft Excel file (when properly formatted into a table of columnar data) can be imported into SAS. (We’ll discuss data file types that can be imported into SAS in Chapter 3.) SAS Essentials - Elliott & Woodward

Help -> SAS Help and Documentation SAS Essentials - Elliott & Woodward

1.5 Summary, Chapter 1 This chapter provided an overview of SAS and examples of how to run an existing SAS program. In the following chapters, we will discuss the components of a SAS program, including how to enter data, how to request analyses, and how to format and read output. Continue to Chapter 2: Getting Data Into SAS. SAS Essentials - Elliott & Woodward