This example uses an INVALUE statement to create a numeric informat
that converts numeric and character raw data to numeric data.
This program converts quarterly employee evaluation grades, which are
alphabetic, into numeric values so that reports can be generated that sum
the grades up as points.
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
libname proclib 'SAS-library-1';
libname library 'SAS-library-2'; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
options nodate pageno=1 linesize=64 pagesize=40; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc format library=library; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
invalue evaluation 'O'=4
'S'=3
'E'=2
'C'=1
'N'=0;
run; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
data proclib.points;
input EmployeeId $ (Q1-Q4) (evaluation.,+1);
TotalPoints=sum(of q1-q4);
datalines;
2355 S O O S
5889 2 2 2 2
3878 C E E E
4409 0 1 1 1
3985 3 3 3 2
0740 S E E S
2398 E E C C
5162 C C C E
4421 3 2 2 2
7385 C C C N
; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc print data=proclib.points noobs; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
title 'The PROCLIB.POINTS Data Set';
run; |
The PROCLIB.POINTS Data Set 1
Employee Total
Id Q1 Q2 Q3 Q4 Points
2355 3 4 4 3 14
5889 2 2 2 2 8
3878 1 2 2 2 7
4409 0 1 1 1 3
3985 3 3 3 2 11
0740 3 2 2 3 10
2398 2 2 1 1 6
5162 1 1 1 2 5
4421 3 2 2 2 9
7385 1 1 1 0 3
![[untitled graphic]](images/chap18-ex4.gif)
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.