APPENDIX D

INTRODUCTION TO SAS

One of the hardest parts about learning SAS is creating data sets. For the most part, this appendix deals with data set creation. It is vital to note that the default data set used by SAS at any given time is the data set most recently created. We can specify the data set for any SAS procedure (PROC). Suppose we wish to do multiple regression analysis on a data set named delivery. The appropriate PROC REG statement is

proc reg data=delivery;

We now consider in more detail how to create SAS data sets.

D.1 BASIC DATA ENTRY

A. Using the SAS Editor Window

The easiest way to enter data into SAS is to use the SAS Editor. We will use the delivery time data, given in Table 3.2 as the example throughout this appendix.

Step 1: Open the SAS Editor Window The SAS Editor window opens automatically upon starting the Windows or UNIX versions of SAS.

Step 2: The Data Command Each SAS data set requires a name, which the data statement provides. This appendix uses a convention whereby all capital letters within a SAS command indicates a name the user must provide. The simplest form of the data statement is

data NAME;

The most painful lesson learning SAS is the use of the semicolon (;). Each SAS command must end in a semicolon. It seems like 95% of the mistakes made by SAS novices is to ...

Get Introduction to Linear Regression Analysis, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.