Just Enough SAS®: A Quick-Start Guide to SAS® for Engineers

Book description

In Just Enough SAS: A Quick-Start Guide to SAS for Engineers, Robert Rutledge provides "just enough" instruction on a broad variety of topics so that a new SAS user can become productive very quickly. Although most of the material in the book is geared toward a general audience, engineers will especially benefit from the focus on analysis of quality and reliability data found in Chapters 9 and 10 as well as in the examples throughout the book. This comprehensive text, prepared using SAS 9.2, can be used both as a tutorial for getting started with SAS and as a reference for details that even experienced SAS users find themselves looking up over and over again. In addition, the companion code to the book includes a set of commonly used utility macros that allow SAS users to wield maximum power with minimal effort. A complete bibliography provides readers with numerous opportunities for further learning.Topics addressed include bringing data into SAS from a spreadsheet or relational database, plotting data with ODS Statistical Graphics, summarizing and manipulating data for analysis using DATA steps and procedures, publishing results on the Internet and in PDF and RTF, creating appropriate plots of data using PROC GPLOT and PROC GCHART and the newer statistical graphics procedures, with particular emphasis on quality control and reliability analysis - key areas for engineers working in high-tech manufacturing and development, and using the SAS macro language to streamline and automate data analysis projects.New SAS users will find Rutledge's book useful as a quick-start guide to doing meaningful work with SAS, and experienced users will find numerous tips and techniques for improving and extending their coding methods.

Table of contents

  1. Copyright
  2. About This Book
    1. Purpose
    2. Is This Book for You?
    3. Typographical Conventions
    4. Companion Web Site
    5. Example Code—Examples from This Book at Your Fingertips
    6. PDF of This Book
    7. Getting Help
      1. Books
      2. SAS Web Site
      3. Google
      4. SAS_L
      5. SAS Technical Support
      6. SAS Training
      7. SAS Global Forum (Formerly SUGI)
    8. SAS Conference Papers
    9. Additional Resources
    10. Comments or Questions?
    11. Acknowledgments
  3. 1. Getting Started
    1. 1.1. Introduction
    2. 1.2. Installing the Sample Code
      1. 1.2.1. SAS for Windows
      2. 1.2.2. SAS for UNIX
      3. 1.2.3. Windows vs. UNIX
    3. 1.3. Starting a SAS Session
      1. 1.3.1. SAS for Windows
      2. 1.3.2. SAS for UNIX
      3. 1.3.3. Site License and Path to autoexec.sas
    4. 1.4. Writing, Submitting, and Saving SAS Code
      1. 1.4.1. Macro Functions and Variables
      2. 1.4.2. Writing and Submitting Code
      3. 1.4.3. Saving Code
      4. 1.4.4. Using the %INCLUDE Function to Run SAS Code
    5. 1.5. Using autoexec.sas
    6. 1.6. Just Enough Syntax
      1. 1.6.1. SAS Statements
      2. 1.6.2. SAS Names
    7. 1.7. SAS Programming
      1. 1.7.1. DATA Steps (Chapter 2)
      2. 1.7.2. Procedures (Various Chapters)
      3. 1.7.3. Macro Programs (Chapter 11)
      4. 1.7.4. The Output Delivery System (Chapter 7)
    8. 1.8. SAS Procedures
    9. 1.9. Debugging Basics
      1. 1.9.1. Detecting Problems
      2. 1.9.2. Correcting Problems
      3. 1.9.3. Escaping from a Runaway Program
    10. 1.10. Chapter Summary
      1. 1.10.1. Recap
      2. 1.10.2. For More Information
          1. SAS Online Documentation
          2. Books
          3. SAS Conference Papers
      3. 1.10.3. Exercises
  4. 2. DATA Step Programming
    1. 2.1. Introduction
    2. 2.2. Creating SAS Data Sets
      1. 2.2.1. Creating a Data Set by Entering Each Line of Data
      2. 2.2.2. Using INPUT and DATALINES Statements
      3. 2.2.3. Using DO Loops, Conditional Logic, and SAS Functions
      4. 2.2.4. Creating a New Data Set from Existing Data Sets
      5. 2.2.5. LENGTH, INFORMAT, FORMAT, and LABEL Statements
        1. LENGTH Statements
        2. INFORMAT and FORMAT Statements
        3. LABEL Statements
    3. 2.3. Saving SAS Data Sets
    4. 2.4. SAS Functions and CALL Routines
      1. 2.4.1. Numeric Functions and CALL Routines
      2. 2.4.2. Date, Time, and Datetime Functions
      3. 2.4.3. Character Functions
      4. 2.4.4. The LAGn() and DIFn() Functions
    5. 2.5. The RETAIN Statement
    6. 2.6. Selecting Subsets of Data Sets
      1. 2.6.1. Selecting a Subset of Columns
      2. 2.6.2. Selecting a Subset of Rows
    7. 2.7. Sorting Data Sets
      1. 2.7.1. Automatic Variables: FIRST.var and LAST.var
      2. 2.7.2. Selecting Unique Records and Duplicates
    8. 2.8. Merging Data Sets
      1. 2.8.1. Automatic Variable: IN
      2. 2.8.2. Selecting Records by Which Data Sets They Are Found In
    9. 2.9. More Than Enough
      1. 2.9.1. PROC DATASETS
      2. 2.9.2. PROC COMPARE
      3. 2.9.3. PROC TRANSPOSE
      4. 2.9.4. Arrays
    10. 2.10. Chapter Summary
      1. 2.10.1. Recap
      2. 2.10.2. For More Information
          1. Books
          2. SAS Conference Papers
      3. 2.10.3. Exercises
  5. 3. Data Out, Data In—Spreadsheets
    1. 3.1. Introduction
    2. 3.2. Exporting a SAS Data Set to a Spreadsheet
      1. 3.2.1. Using PROC EXPORT
      2. 3.2.2. Using ODS CSVALL
      3. 3.2.3. Using the MSOffice2K Tagset
    3. 3.3. Importing Spreadsheet Data to SAS
      1. 3.3.1. Using PROC IMPORT
      2. 3.3.2. Fixing Data Import Problems
        1. 3.3.2.1. "Invalid data" Messages in the Log Window
        2. 3.3.2.2. The Corresponding Records in the CSV File
        3. 3.3.2.3. The SAS Code Written by PROC IMPORT
      3. 3.3.3. Problems with Control Characters
      4. 3.3.4. A Trial-and-Error Process for Importing CSV Files
    4. 3.4. More Than Enough
      1. 3.4.1. Using the ExcelXP Tagset to Export SAS Data Sets
        1. 3.4.1.1. Titles, Footnotes, Styles, and Formatting
        2. 3.4.1.2. Customizing the Worksheet Names
      2. 3.4.2. Using the %XLXP2SAS Macro to Import SAS Data
    5. 3.5. Chapter Summary
      1. 3.5.1. Recap
      2. 3.5.2. For More Information
          1. Books
          2. SAS Conference Papers
      3. 3.5.3. Exercises
  6. 4. Data Out, Data In—Relational Databases
    1. 4.1. Introduction
      1. 4.1.1. SQL and PROC SQL
    2. 4.2. Using PROC SQL with SAS Data Sets
      1. 4.2.1. Extract Rows and Columns from a Data Set (or Table)
      2. 4.2.2. Joining Rows from Multiple Data Sets
      3. 4.2.3. Inner Joins
      4. 4.2.4. Outer Joins
    3. 4.3. Using SAS with a Database Management System
      1. 4.3.1. SAS/ACCESS Software
      2. 4.3.2. Accessing a DBMS
      3. 4.3.3. Exporting SAS Data Sets to a DBMS Using a LIBNAME Statement
      4. 4.3.4. Importing Data from a DBMS Using the SQL Pass-Through Facility
      5. 4.3.5. Using SAS to Explore the Contents of a DBMS
        1. 4.3.5.1. Tables and Views
        2. 4.3.5.2. Fields
        3. 4.3.5.3. Records
      6. 4.3.6. Importing Data from a DBMS Using a LIBNAME Statement
      7. 4.3.7. Extracting Records That Match Values in a List
    4. 4.4. More Than Enough
      1. 4.4.1. Step 1: Create the SAS Data Sets
      2. 4.4.2. Step 2: Export the SAS Data Sets to a Multi-Sheet Workbook
      3. 4.4.3. Step 3: Customize Your Workbook
    5. 4.5. Chapter Summary
      1. 4.5.1. Recap
      2. 4.5.2. For More Information
          1. Books
          2. SAS Conference Papers
      3. 4.5.3. Exercises
  7. 5. Summarizing Your Data
    1. 5.1. Introduction
      1. 5.1.1. Sample Component Data
    2. 5.2. PROC MEANS
      1. 5.2.1. Run PROC MEANS to Summarize Numeric Variables
      2. 5.2.2. Use an OUTPUT Statement to Create an Output Data Set
      3. 5.2.3. Use a VAR Statement to Select Variables for Analysis
      4. 5.2.4. Use Keywords to Select the Required Statistics
      5. 5.2.5. Use a CLASS Statement to Compute Statistics for Subsets
      6. 5.2.6. Add Normal Confidence Limits on the Means
      7. 5.2.7. Add Confidence Limits on Poisson and Binomial Parameters
          1. Poisson Distribution
          2. Binomial Distribution
    3. 5.3. PROC TABULATE
    4. 5.4. PROC REPORT
    5. 5.5. PROC BOXPLOT
      1. 5.5.1. Skeletal Box Plots
      2. 5.5.2. Schematic Box Plots
    6. 5.6. PROC ANOM
      1. 5.6.1. XCHART for Continuous Variables
      2. 5.6.2. UCHART Statement for Rates from Group Counts
      3. 5.6.3. PCHART for Proportions from Group Counts
    7. 5.7. PROC UNIVARIATE
    8. 5.8. PROC FREQ
    9. 5.9. More Than Enough
    10. 5.10. Chapter Summary
      1. 5.10.1. Recap
      2. 5.10.2. For More Information
          1. Books
          2. SAS Conference Papers
          3. Other Papers
      3. 5.10.3. Exercises
  8. 6. Plotting Your Data with SAS/GRAPH Software
    1. 6.1. Introduction
      1. 6.1.1. Data for the Examples
    2. 6.2. Viewing, Saving, and Naming Your Graphic Output
    3. 6.3. PROC GPLOT
      1. 6.3.1. The Basic Forms of the PLOT and PLOT2 Statements
        1. 6.3.1.1. Simple Plot of Y vs. X
        2. 6.3.1.2. Plots on Separate Graphs for Each Value of a Third Variable
        3. 6.3.1.3. Plots on the Same Graph for Each Value of a Third Variable
        4. 6.3.1.4. Plot Multiple Y Variables vs. X Using the Same Y Axis
        5. 6.3.1.5. Plot Multiple Y Variables Using Two Different Y Axes
        6. 6.3.1.6. Combinations of the Basic Forms
      2. 6.3.2. Options to Customize GPLOT Output
        1. 6.3.2.1. Global Graphic Options
        2. 6.3.2.2. Titles and Footnotes
        3. 6.3.2.3. Axes
        4. 6.3.2.4. Legends
        5. 6.3.2.5. Reference Lines
        6. 6.3.2.6. Symbols and Lines
          1. SAS/GRAPH Symbols and Fonts
          2. SAS/GRAPH Colors
        7. 6.3.2.7. Box-and-Whisker Plots
      3. 6.3.3. GPLOT Example: Plotting Group Confidence Limits
        1. 6.3.3.1. Draw a Line Joining the Confidence Limits
        2. 6.3.3.2. Use the SKIPMISS Option to Force Breaks in Plotted Lines
        3. 6.3.3.3. Use the ANNOTATE Option to Label Selected Plot Points
        4. 6.3.3.4. Trend Plot of Defect Rate with Confidence Limits
    4. 6.4. PROC GCHART
      1. 6.4.1. Selecting Statistics with the TYPE and SUMVAR Options
      2. 6.4.2. Using the MIDPOINTS and DISCRETE Options
      3. 6.4.3. Using PATTERN Statements to Control Bar Fill Patterns
      4. 6.4.4. Using the GROUP Option
      5. 6.4.5. Using VBAR to Create Vertical Bar Charts
      6. 6.4.6. Controlling the Display of Statistics with Bar Charts
      7. 6.4.7. Using the SUBGROUP Option
      8. 6.4.8. Creating a Stacked Bar Chart for Failure Rates
    5. 6.5. More Than Enough
      1. 6.5.1. PROC GCHART: Block Charts
      2. 6.5.2. PROC GCHART: Pie Charts
      3. 6.5.3. PROC GPLOT: Bubble Plots
      4. 6.5.4. PROC GMAP: Choro, Block, Prism, and Surface Plots
      5. 6.5.5. PROC GCONTOUR: Contour Plots
      6. 6.5.6. PROC G3D: Surface and Scatter Plots
    6. 6.6. Chapter Summary
      1. 6.6.1. Recap
      2. 6.6.2. For More Information
          1. Books
          2. SAS Conference Papers
      3. 6.6.3. Exercises
  9. 7. The Output Delivery System
    1. 7.1. Introduction
      1. 7.1.1. The Sample Report
    2. 7.2. Publishing Your Report in RTF
    3. 7.3. Publishing Your Report in PDF
    4. 7.4. Publishing Your Report to the Web
      1. 7.4.1. Putting Your ODS HTML Output in Frames
      2. 7.4.2. Adding Hyperlinks to Your Web Pages
      3. 7.4.3. Adding Traffic Lighting to PROC REPORT
    5. 7.5. Using ODS to Save and Select Procedure Output
      1. 7.5.1. Using ODS TRACE to Identify Output Objects
      2. 7.5.2. Using ODS OUTPUT to Save Output to Data Sets
      3. 7.5.3. Using ODS SELECT and EXCLUDE to Customize Your Report
    6. 7.6. More Than Enough
      1. 7.6.1. Including Your Own HTML Code
      2. 7.6.2. Selecting a Style for Your ODS Output
      3. 7.6.3. Creating Your Own STYLE
    7. 7.7. Chapter Summary
      1. 7.7.1. Recap
      2. 7.7.2. For More Information
          1. Books
          2. SAS Conference Papers
      3. 7.7.3. Exercises
  10. 8. Plotting Your Data with ODS Graphics
    1. 8.1. Introduction
      1. 8.1.1. Statistical Procedures Using ODS Graphics
      2. 8.1.2. New SG Procedures in SAS/GRAPH
        1. 8.1.2.1. PROC SGPLOT
        2. 8.1.2.2. PROC SGPANEL
        3. 8.1.2.3. PROC SGSCATTER
        4. 8.1.2.4. PROC SGRENDER
      3. 8.1.3. ODS Styles
      4. 8.1.4. Graph Template Language
    2. 8.2. ODS Statistical Graphics
    3. 8.3. PROC SGPLOT
      1. 8.3.1. Plot Types
        1. 8.3.1.1. Basic X-Y Plots
        2. 8.3.1.2. Limit Plots
        3. 8.3.1.3. Bar Charts
        4. 8.3.1.4. Distribution Plots
        5. 8.3.1.5. Data Fit Plots
      2. 8.3.2. Plotting Multiple Lines on the Same Graph
        1. 8.3.2.1. Using the BY and GROUP Options
        2. 8.3.2.2. Using Multiple Plot Statements
        3. 8.3.2.3. Using a Second X or Y Axis
      3. 8.3.3. Options to Customize SGPLOT Output
        1. 8.3.3.1. SGPLOT Statements and Options
        2. 8.3.3.2. Titles and Footnotes
        3. 8.3.3.3. Axes
        4. 8.3.3.4. Symbols and Lines
        5. 8.3.3.5. Legends
        6. 8.3.3.6. Curve Labels
        7. 8.3.3.7. Reference Lines
        8. 8.3.3.8. Insets
      4. 8.3.4. SGPLOT Examples
        1. 8.3.4.1. HISTOGRAM and DENSITY
        2. 8.3.4.2. HBOX and VBOX
        3. 8.3.4.3. Plotting Group Confidence Limits
      5. 8.3.5. Adding Hyperlinks to Plots Created with SGPLOT
    4. 8.4. PROC SGPANEL
    5. 8.5. PROC SGSCATTER
    6. 8.6. More Than Enough
    7. 8.7. Chapter Summary
      1. 8.7.1. Recap
      2. 8.7.2. For More Information
          1. SAS Conference Papers
      3. 8.7.3. Exercises
  11. 9. Analyzing Quality Data with SAS
    1. 9.1. Introduction
      1. 9.1.1. Quality Data for the Examples
    2. 9.2. Deciding Whether the Process Is In Control
    3. 9.3. Measuring Process Capability
    4. 9.4. Monitoring the Process
    5. 9.5. P-Charts for Fraction Failing
    6. 9.6. U-Charts for Defects per Unit
    7. 9.7. More Than Enough
    8. 9.8. Chapter Summary
      1. 9.8.1. Recap
      2. 9.8.2. For More Information
          1. Books
          2. Papers
      3. 9.8.3. Exercises
  12. 10. Analyzing Reliability Data with SAS
    1. 10.1. Introduction
      1. 10.1.1. Parametric Lifetime Distributions
      2. 10.1.2. Acceleration and Proportional Hazards Models
      3. 10.1.3. Sample Data for Non-Repairable Units
      4. 10.1.4. Sample Data for Repairable Units
    2. 10.2. PROC RELIABILITY
      1. 10.2.1. Fitting a Single Weibull Distribution
      2. 10.2.2. Fitting Multiple Weibull Distributions
      3. 10.2.3. Fitting a Weibull Acceleration Model
      4. 10.2.4. Fitting an Arrhenius Acceleration Model
    3. 10.3. PROC LIFEREG
      1. 10.3.1. Fitting a Single Weibull Distribution
      2. 10.3.2. Fitting an Arrhenius Acceleration Model
      3. 10.3.3. Probability Plots for Each Temperature
    4. 10.4. PROC LIFETEST
    5. 10.5. PROC PHREG
    6. 10.6. The Reliability of Repairable Units
    7. 10.7. More Than Enough
    8. 10.8. Chapter Summary
      1. 10.8.1. Recap
      2. 10.8.2. For More Information
          1. Books
          2. Papers
      3. 10.8.3. Exercises
  13. 11. SAS Macro Programming
    1. 11.1. Introduction
    2. 11.2. Macro Variables
      1. 11.2.1. Viewing Macro Variables
      2. 11.2.2. Creating Macro Variables
        1. 11.2.2.1. Using the %LET Function
        2. 11.2.2.2. Using CALL SYMPUT in a DATA Step
        3. 11.2.2.3. Using PROC SQL
      3. 11.2.3. Deleting Macro Variables
      4. 11.2.4. Using Macro Variables
        1. 11.2.4.1. Using a Period to Delimit a Macro Variable Name
        2. 11.2.4.2. Using Double Quotes to Resolve Macro Variables
        3. 11.2.4.3. Using Macro Functions and Autocall Programs
        4. 11.2.4.4. The %EVAL and %SYSEVALF Functions
    3. 11.3. Macro Programs
      1. 11.3.1. Writing a Macro Program
      2. 11.3.2. Using Macro Parameters
      3. 11.3.3. Looping, Conditional Execution, and Branching
        1. 11.3.3.1. Macro Language Statements
        2. 11.3.3.2. Using a %DO Statement to Create a Do Loop
        3. 11.3.3.3. Logical Expressions
        4. 11.3.3.4. Using an %IF Statement for Conditional Execution
        5. 11.3.3.5. Using a %GOTO Statement to Branch to a Code Line
      4. 11.3.4. Global and Local Macro Variables
      5. 11.3.5. Using MPRINT, MLOGIC, and SYMBOLGEN
      6. 11.3.6. Using SASAUTOS to Make Your Macros Accessible
    4. 11.4. Utility Macros
      1. 11.4.1. %check_autocall
      2. 11.4.2. %theDate
      3. 11.4.3. %sasver_os
      4. 11.4.4. %foot_note
      5. 11.4.5. %my_symbols
      6. 11.4.6. %delvars
      7. 11.4.7. %dups
      8. 11.4.8. %obscnt
      9. 11.4.9. %makedir
      10. 11.4.10. %varexist
      11. 11.4.11. %vars_in
      12. 11.4.12. %DBMSlist, %RunQuery, and %MakeList
      13. 11.4.13. %sas_papers
    5. 11.5. More Than Enough
    6. 11.6. Chapter Summary
      1. 11.6.1. Recap
      2. 11.6.2. For More Information
          1. Books
          2. SAS Conference Papers
      3. 11.6.3. Exercises
  14. Bibliography
    1. Books
    2. Papers

Product information

  • Title: Just Enough SAS®: A Quick-Start Guide to SAS® for Engineers
  • Author(s):
  • Release date: April 2009
  • Publisher(s): SAS Institute
  • ISBN: 9781599946498