| Understanding DATA Step Processing |
| Debugging a DATA
Step |
Incorrectly identifying a variable's type is another common execution-time
error. As you know, the values for IDnum are character values.
Suppose you forget to place the dollar sign ($) after the variable's name
in your INPUT statement. This is not a compile-time error because SAS software
cannot verify IDnum 's type until the data values for
IDnum are read.
data perm.update;
infile invent;
input Item $ 1-13 IDnum 15-19
InStock 21-22 BackOrd 24-25;
Total=instock+backord;
run;
|
Raw Data File Invent
| 1---+----10---+----20---+- |
| Bird Feeder LG088 3 20 |
| 6 Glass Mugs SB082 6 12 |
| Glass Tray BQ049 12 6 |
| Padded Hangrs MN256 15 20 |
| Jewelry Box AJ498 23 0 |
| Red Apron AQ072 9 12 |
| Crystal Vase AQ672 27 0 |
| Picnic Basket LS930 21 0 |
| Brass Clock AN910 2 10 |
| In this case, the DATA step completes the execution phase and the observations are written to the data set. However, several notes appear in the log. |
SAS Log
NOTE: Invalid data for IDnum in line 7 15-19.
RULE: ----+----1----+----2----+----3----+----4--
07 Crystal Vase AQ672 27 0
Item=Crystal Vase IDnum=. InStock=27 BackOrd=0
Total=27 _ERROR_=1 _N_=7
NOTE: Invalid data for IDnum in line 8 15-19.
08 Picnic Basket LS930 21 0
Item=Picnic Basket IDnum=. InStock=21 BackOrd=0
Total=21 _ERROR_=1 _N_=8
NOTE: Invalid data for IDnum in line 9 15-19.
09 Brass Clock AN910 2 10
Item=Brass Clock IDnum=. InStock=2 BackOrd=10
Total=12 _ERROR_=1 _N_=9
NOTE: 9 records were read from the infile INVENT.
NOTE: The data set PERM.UPDATE has 9 observations
and 5 variables.
|
| Each note identifies the location of the invalid data for each observation. In this example, the invalid data are located in columns 15-19 for all observations. |
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.