This example creates a format and shows how
to use ranges with character
strings.
libname proclib 'SAS-library';
|
options nodate pageno=1 linesize=80 pagesize=40; |
|
data train;
set proclib.staff(keep=name idnumber);
run; |
|
proc print data=train noobs; |
|
title 'The TRAIN Data Set without a Format';
run; |
The TRAIN Data Set without a Format 1
Id
Name Number
Capalleti, Jimmy 2355
Chen, Len 5889
Davis, Brad 3878
Leung, Brenda 4409
Martinez, Maria 3985
Orfali, Philip 0740
Patel, Mary 2398
Smith, Robert 5162
Sorrell, Joseph 4421
Zook, Carla 7385
|
proc format; |
|
value $skilltest 'a'-<'e','A'-<'E'='Test A'
'e'-<'m','E'-<'M'='Test B'
'm'-'z~','M'-'Z~'='Test C';
run; |
|
proc report data=train nowd headskip;
column name name=test idnumber;
define test / display format=$skilltest. 'Test';
define idnumber / center;
title 'Test Assignment for Each Employee';
run; |
Test Assignment for Each Employee 1
Name Test IdNumber
Capalleti, Jimmy Test A 2355
Chen, Len Test A 5889
Davis, Brad Test A 3878
Leung, Brenda Test B 4409
Martinez, Maria Test C 3985
Orfali, Philip Test C 0740
Patel, Mary Test C 2398
Smith, Robert Test C 5162
Sorrell, Joseph Test C 4421
Zook, Carla Test C 7385
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.