A Gentle Introduction to Statistics Using SAS Studio. Ron Cody

Чтение книги онлайн.

Читать онлайн книгу A Gentle Introduction to Statistics Using SAS Studio - Ron Cody страница 7

Автор:
Жанр:
Серия:
Издательство:
A Gentle Introduction to Statistics Using SAS Studio - Ron Cody

Скачать книгу

alt="Figure 1.1 Some JMP Help Options"/>

      Notice that the triangle to the left of the word My Libraries is now pointing downward, telling you that you are looking at sub-lists. Under My Libraries, you see a list of libraries. Libraries are places where SAS puts programs and data sets (think of folders on your hard drive). This author has already created a library called STATS, so you will not see that library on your computer until you run the Create_Datasets.sas program. However, SAS Studio comes with some libraries already installed. The WORK library is a temporary library—all data and programs placed there will be deleted when you exit SAS Studio.

      The SASHELP library, which comes with all SAS versions, contains over 200 data sets, covering a variety of topics such as car sales and health data. These data sets are quite useful because you can use them for examples or testing your code. Click the SASHELP library to see the list of built-in data sets. (See Figure 4.7 below.)

      Figure 4.7: Expanding the SASHELP Libraries

Figure 1.1 Some JMP Help Options

      Let’s scroll down to the HEART data set to demonstrate some of the features of SAS Studio. You can either double-click the Heart data set or highlight it or drag it to the work area. When you do this, SAS Studio displays the columns of the table and a listing of some of the top rows and columns of the actual table.

      Throughout this book and in the various SAS Studio tasks, the terms Columns and Variables, Rows and Observations, and data sets and tables are used interchangeably. Originally, SAS used the terms Variables, Observations, and data sets instead of the terminology that came along with many database programs (such as SQL) where the terms Columns, Rows, and tables are used instead.

      Having opened the Heart data set, your screen will look as follows:

      Figure 4.8: The HEART Data Set

Figure 1.1 Some JMP Help Options

      The Columns (variables) in the data set are displayed on the left (Figure 4.9).

      Figure 4.9: Columns in the HEART Data Set

Figure 1.1 Some JMP Help Options

      You can click Select all to toggle between selecting all the variables or none. You will see two easy ways to select columns in just a moment.

      The right side of the screen shows a portion of the actual table (Figure 4.10).

      Figure 4.10: Columns and Rows from the HEART Data Set

Figure 1.1 Some JMP Help Options

      You can use the horizontal and vertical scroll bars to examine additional columns and rows of this table (Figure 4.11).

      Figure 4.11: Horizontal and Vertical Scroll Bars

Figure 1.1 Some JMP Help Options

      As promised, you will now see how to select (or deselect) columns from a table. If you want to display just a few columns, it is best to click Select all, then deselect all of the columns. Then, to select the columns that you want, use one or both of these methods:

      ● Click the check box of any column to select it—it will be displayed in the table. If a column is already selected, you can deselect it if you uncheck it.

      ● Click the check box of one column, hold down the Shift key and click the check box of another column. All columns from the first to the last will be selected.

      In Figure 4.12 (below), columns for Sex, Height, Weight, Diastolic (diastolic blood pressure), and Systolic (systolic blood pressure) were selected.

      Figure 4.12: Selecting Variables

Figure 1.1 Some JMP Help Options

      In this chapter, you saw how to find built-in SAS Studio tasks, and you learned how to select data sets from the SASHELP library. The next step is to perform these operations on your own data. Chapter 5 shows you how to import data from Excel workbooks or CSV files and create SAS data sets.

      Chapter 5: Importing Data into SAS

       Introduction

       Exploring the Utilities Tab

       Importing Data from an Excel Workbook

       Listing the SAS Data Set

       Importing an Excel Workbook with Invalid SAS Variable Names

       Importing an Excel Workbook That Does Not Have Column Headings

       Importing Data from a CSV File

       Shared Folders (Accessing Data from Anywhere on Your Hard Drive)

       Conclusion

      Now that you have learned how to perform operations on built-in SASHELP data sets, it’s time to see how to import your own data into a SAS library.

      SAS data sets contain two parts: the first part is called the data descriptor, also known as metadata. Metadata is a fancy word for data about your data. In the case of a SAS data set, this portion of the data set contains such information as the number of rows and columns in the table, the column names, the data type for each column (SAS has only two data types—character and numeric), and other information about when the data set was created.

      The second part of a SAS data set contains the actual data values. If you tried to examine a SAS data set using another program such as Word or Notebook, it would show up as nonsense. Only SAS can read, write, and analyze data in a SAS data set. If you have data in Excel workbooks or text files, you need to convert that data into a SAS data set before you can use SAS to modify or analyze the data.

      In this chapter, you will see how easy it is to import your own data from Excel workbooks, CSV files, and many other file formats such as Microsoft Access and SPSS, and create SAS data sets.

      Start by clicking the Tasks and Utilities tab in the navigation pane. It looks like this.

      Figure 5.1: The Tasks and Utilities Tab in the Navigation Pane

Скачать книгу