The log includes a note indicating that invalid data
appears for the variable RecHR in line 14 of the raw data file, columns
35-37.
This note is followed
by a column ruler and the actual data line that contains the invalid
value for RecHR.
Output 6.1 SAS Log
NOTE: Invalid data for RecHR in line 14 35-37.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----
14 2575 Quigley, M 74 152 Q13 11 26 I 80
ID=2575 Name=Quigley, M RestHR=74 MaxHR=152 RecHR=. TimeMin=11 TimeSec=26 Tolerance=I _ERROR_=1
_N_=14
NOTE: 21 records were read from the infile TEST.
The minimum record length was 80.
The maximum record length was 80.
NOTE: The data set SASUSER.STRESS has 21 observations and 8 variables.
NOTE: DATA statement used 0.13 seconds
The value Q13 is a data-entry
error. It was entered incorrectly for the variable RecHR.
RecHR is a numeric variable,
but Q13 is not a valid number. So RecHR is assigned a missing value,
as indicated in the log. Because RecHR is numeric, the missing value
is represented with a period (RecHR=.).
Notice, though, that
the DATA step does not fail as a result of the invalid data but continues
to execute. Unlike syntax errors, invalid data errors do not cause
SAS to stop processing a program.
When you correct the
invalid value and rerun the DATA step, the log will then show that
the data set Sasuser.Stress was created with 21 observations and 8
variables. There will be no messages about invalid data.
Output 6.2 SAS Log
NOTE: The infile TESTS2 is:
File Name=Z:sasuser ests.dat,
RECFM=V, LRECL=256
NOTE: 21 records were read from the infile TESTS.
The minimum record length was 80.
The maximum record length was 80.
NOTE: The data set SASUSER.STRESS has 21 observations
and 8 variables.
NOTE: DATA statement used 0.14 seconds
After correcting the raw data file,
you can print the data again to verify that it is correct.
proc print data=sasuser.stress;
run;
When you use the DATA
step to read raw data, remember the steps that you followed in this
chapter. These help you to avoid wasting resources when accessing
data:
-
write the DATA step using the OBS=
option in the INFILE statement
-
-
check the log for messages
-
view the resulting data set
-
remove the OBS= option and resubmit
the DATA step
-
-
view the resulting data set again