4PREPARING DATA FOR ANALYSIS

You've entered your data into SAS, but before you can use them in SAS, you typically need to make corrections, perform calculations, and otherwise prepare your data for analysis. This step is sometimes overlooked in classroom settings where you often use ready-to-analyze textbook data. When you gather your own data, or even when you acquire data from a database, the data may require some changes before you can use them in an analysis.

All of the data manipulation statements discussed in this chapter appear in your program code within the DATA step, except for PROC FORMAT. That is, they appear after the DATA statement and before the first RUN or PROC statement. Thus, all of the results of the data manipulations performed by these statements become part of the active data set.

4.1 LABELING VARIABLES WITH EXPLANATORY NAMES

SAS labels are used to provide descriptive names for variables. Data sets often contain cryptic variable names such as ID, SBP, WT, and so on. For people familiar with the data set, these make perfect sense. However, if ...

Get SAS Essentials: Mastering SAS for Data Analytics, 2nd 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.