Creating transformation code
Now that we have planned our analytic dataset, we will prepare our transformation code. First, we will deal with creating categorical grouping variables such as agrp
from _AGE80
. Next, we will clean up the continuous variable SLEPTIM1
into a new transformed variable, SLEPTIM2
. We will go on to make indicator variables where needed, as we have planned for vetflag
. Finally, we will talk about how dates and numerical values can be used as indexes in SAS data warehouses, and then we will demonstrate exporting the transformed dataset.
Designing categorical grouping variables
Earlier, we presented our plan for coding agrp
from _AGE80
. Let's start our transformation code by making agrp
:
We will start by copying our demonstration dataset
Chap7_1
fromLIBNAME X
to theWORK
directory and naming itbrfss_a
.In the data step, we will add
agrp
usingif
/then
statements.We will then output the
brfss_b
dataset.We will follow this operation...