This example uses a VALUE statement to create a character format
that
prints a value of a character variable as a different character string.
|
libname proclib 'SAS-library-1';
libname library 'SAS-library-2'; |
|
options nodate pageno=1 linesize=80 pagesize=40; |
|
proc format library=library; |
|
value $city 'BR1'='Birmingham UK'
'BR2'='Plymouth UK'
'BR3'='York UK'
'US1'='Denver USA'
'US2'='Miami USA'
other='INCORRECT CODE';
run; |
|
proc print data=proclib.staff noobs label; |
|
label salary='Salary in U.S. Dollars'; |
|
format salary uscurrency. site $city.; |
|
title 'PROCLIB.STAFF with a Format for the Variables';
title2 'Salary and Site';
run; |
PROCLIB.STAFF with a Format for the Variables 1
Salary and Site
Salary in
Id U.S. Hire
Name Number Dollars Site Date
Capalleti, Jimmy 2355 $34,072 Birmingham UK 30JAN79
Chen, Len 5889 $33,771 Birmingham UK 18JUN76
Davis, Brad 3878 $31,509 Plymouth UK 20MAR84
Leung, Brenda 4409 $55,256 Plymouth UK 18SEP74
Martinez, Maria 3985 $78,980 Miami USA 10JAN93
Orfali, Philip 0740 $80,648 Miami USA 16FEB83
Patel, Mary 2398 $56,643 York UK 02FEB90
Smith, Robert 5162 $64,561 INCORRECT CODE 15APR86
Sorrell, Joseph 4421 $62,403 Denver USA 19JUN93
Zook, Carla 7385 $37,010 York UK 18DEC91
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.