Ask yourself (act like you are the SAS compiler):
Look again at the data step:
Data Grades; ID = _N_; Input Score; GRADE = Put (Score, Score.); Datalines;
Where does the compiler first encounter GRADE?
Is GRADE a character or numeric variable?
What is the length of GRADE? (How many bytes of storage are used to store each value on disk?)
Normally FORMATS are specified with a field width (e.g. FORMAT SCORE 5.1; ) If a field width is not specified, a default width is used.
What value of w is used when SAS compiles
GRADE = Put (Score, Scorew.); ?
The output and log
The Print output shows a few interesting features.
Example 4 ID SCORE GRADE 1 55.0 F 2 65.0 D 3 74.0 C 4 76.0 C 5 88.0 B 6 92.0 A 7 94.0 A 8 96.0 A 9 98.0 A 10 0.0 F 11 -1.0 * 12 101.0 A 13 82.1 B 14 89.1 B 15 . .
The log explains the asterisk (somewhat). Below the data step, the following note appears.
NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the "BEST" format.
We will cover more SAS functions later.