SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Formatting Variable Values
Creating User-Defined Formats


Specifying Value Ranges

You can specify a non-inclusive range of numeric values by using the less than symbol (<) to avoid any overlapping. In this example, the range of values from 0 to less than 12 are labeled as child. The next range begins at 12, so the value 12.3 would be assigned the label teenager.

     proc format lib=library;
        value AgeFmt
           0-<12='child'
           12-<20='teenager'
           20-<65='adult'
           65-<100='senior citizen';
     run;

You can also use the keywords LOW and HIGH to specify the lower and upper limits of a variable's value range. The keyword LOW does not include missing values. The keyword OTHER can be used to label missing values and any value that is not specifically addressed in a range.

     proc format lib=library;
        value AgeFmt
           low-<12='child'
           12-<20='teenager'
           20-<65='adult'
           65-high='senior citizen';
           other='unknown';
     run;

When specifying a label for displaying each range, remember to

  • enclose the label in quotes
  • limit the label to 200 characters
  • use two single quotes if you want an apostrophe to appear in the label. For example,
     000='employee''s jobtitle unknown';


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement