Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

Formatting with Style

There are techniques using ODS escape characters that you can use to enhance SAS formats, and so brighten up your output. These techniques use inline formatting functions, most commonly the style function. They are generally available for any ODS destination except Listing, although destinations differ in behaviour to some extent; for details, please refer to the SAS Institute documentation for the ODS ESCAPECHAR statement.

The first example shows how a format can specify bold, italic, choice of font and font colour.

Formatting with style Image1

The resulting output is:

Formatting with style Image2

The ODS escape character is here being specified as "~" (tilde), and this is used in each line of the format definition. It is followed by a call to the style function, inside curly brackets "{}". These brackets contain the text to be displayed, preceded by inside square brackets "[]" the temporary style modifications to be used. In this case, the style attributes affected are color, font_weight, font_style and font_face. Other attributes could be modified in the same way.

The same technique can be used to include Unicode characters within format values:

Formatting with style image3

Formatting with style Image4

The syntax here is a little more intricate. The expressions specifying Unicode characters appear where ordinary text was expected, so a further escape (within the original escape) is needed to introduce them. The ordinary text "Male" etc is outside the curly brackets this time, so appears in the normal font. Lists of Unicode characters can be found on the web, but NB unfortunately only the 4-digit ones can be used in this way.

This by no means exhausts the range of interesting effects that can be specified within format values. Other possibilities, some of them using functions other than style (and still assuming that "~" has been specified as the escape character) include:

  •  ~{super 2}
    which specifies a superscript 2,
  •  ~{dagger}
    which specifies the obelus character , and
  •  ~{style [preimage=imagefilepath]}
    which includes an image. NB the file path for the image file must be an absolute path; relative paths will not work here.