Previous Page | Next Page

The FORMAT Procedure

Example 1: Creating a Picture Format


Procedure features:

PROC FORMAT statement options:

LIBRARY=

PICTURE statement options:

MULT=

PREFIX=

LIBRARY libref

LOW and HIGH keywords

Data set:

PROCLIB.STAFF.


This example uses a PICTURE statement to create a format that prints the values for the variable Salary in the data set PROCLIB.STAFF in U.S. dollars.


Program

 Note about code
libname proclib 'SAS-library-1 ';
libname library 'SAS-library-2';
 Note about code
options nodate pageno=1 linesize=80 pagesize=40;
 Note about code
   proc format library=library;
 Note about code
      picture uscurrency low-high='000,000' (mult=1.61 prefix='$');
   run;
 Note about code
proc print data=proclib.staff noobs label;
 Note about code
   label salary='Salary in U.S. Dollars';
   format salary uscurrency.;
 Note about code
   title 'PROCLIB.STAFF with a Format for the Variable Salary';
run;

Output: Listing

              PROCLIB.STAFF with a Format for the Variable Salary              1

                                         Salary in
                                 Id        U.S.                  Hire
           Name                Number     Dollars     Site       Date

           Capalleti, Jimmy     2355      $34,072     BR1     30JAN79
           Chen, Len            5889      $33,771     BR1     18JUN76
           Davis, Brad          3878      $31,509     BR2     20MAR84
           Leung, Brenda        4409      $55,256     BR2     18SEP74
           Martinez, Maria      3985      $78,980     US2     10JAN93
           Orfali, Philip       0740      $80,648     US2     16FEB83
           Patel, Mary          2398      $56,643     BR3     02FEB90
           Smith, Robert        5162      $64,561     BR5     15APR86
           Sorrell, Joseph      4421      $62,403     US1     19JUN93
           Zook, Carla          7385      $37,010     BR3     18DEC91

Output: HTML

[untitled graphic]

Previous Page | Next Page | Top of Page