2.7 - Summary

2.7 - Summary

In this lesson, we investigated various methods for reading data into a SAS data set. One of the key things to remember from this lesson is that every time you read data into a SAS data set, you need to tell SAS three things:

  1. Where your data reside
  2. The format of your data
  3. Whether you want to create a temporary or permanent SAS data set

In short:

  • If you are reading data instream, use a DATALINES statement.
  • If you are reading data from a raw data file, use an INFILE statement.
  • If you are reading data from another SAS data set, use a SET statement.
  • Use an INPUT statement containing column numbers to read data arranged in neatly defined columns.
  • Use a two-level name in the DATA statement if you want to create a permanent SAS data set.
  • Use a one-level name in the DATA statement if you want to create a temporary SAS data set.

Please be aware that there are other ways of getting your data into SAS that we won't learn in this course. For example, you could use the VIEWTABLE feature, which is similar to entering your data into an Excel spreadsheet. It is simple enough, but we won't investigate that approach here. One of the primary purposes of this course is to learn how to use the SAS programming language, something we can't do when using the VIEWTABLE feature. At least now that you know the VIEWTABLE feature exists, you can investigate it on your own.

We also won't learn how to use the IMPORT procedure to import data directly from other software, such as Excel and Access, into SAS data sets. Doing so requires having the SAS/ACCESS module, i.e. more than the Base SAS software, at your disposal. Instead, we'll proceed assuming that data stored in other software, such as an Excel spreadsheet, can be read into SAS first by exporting it to a raw data file and then reading the data from the raw file into a SAS data set.

In the next lesson, we will investigate the two styles of input that we didn't do much with in this lesson, namely list input and formatted input. Now, it is time to work on some homework problems to give you a chance to put what you have learned in this lesson to good use.

Note! If you've forgotten the guidelines for formatting and commenting programs, you should review them again in Lesson 1. You might also take a look at this program as an example of a well-formatted and well--commented program.

Legend
[1]Link
Has Tooltip/Popover
 Toggleable Visibility