Creating Custom Formats Using the VALUE Statement

Review of Creating Non-Overlapping Formats

You can use the VALUE statement in the FORMAT procedure to create a custom format for displaying data in a particular way. For example, suppose you have airline data and you want to create several custom formats that you can use for your report-writing tasks. You need formats that enable you to do the following:
  • group airline routes into zones
  • label airport codes as International or Domestic
  • group cargo revenue figures into ranges.
The following PROC FORMAT step creates these three formats:
proc format; value $routes 'Route1' = 'Zone 1' 'Route2' - 'Route4' = 'Zone 2' 'Route5' - 'Route7' = 'Zone 3' ' ' = 'Missing' other = 'Unknown'; ...

Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.