Chapter Contents

Previous

Next
The FORMAT Procedure

Example 2: Creating a Format for Character Values


Procedure features:
VALUE statement
OTHER keyword
Data set:
PROCLIB.STAFF .
Format: USCURR .

This example uses a VALUE statement to create a character format that prints a value of a character variable as a different character string.


Program
 Note about code
libname proclib 'SAS-data-library-1';
libname library 'SAS-data-library-2';

options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
   proc format library=library;


 Note about code
      value  $city 'BR1'='Birmingham UK'
                   'BR2'='Plymouth UK'
                   'BR3'='York UK'
                   'US1'='Denver USA'
                   'US2'='Miami USA'
                   other='INCORRECT CODE';
   run;
 Note about code
proc print data=proclib.staff noobs label;
   label salary='Salary in U.S. Dollars';
   format salary uscurr. site $city.;
   title 'PROCLIB.STAFF with a Format for the Variables';
   title2 'Salary and Site';
run;


Output
[HTML Output]  [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.