Example 9.4 Specifying a Numeric or Character Format at Run Time


Format the value of a variable in each observation with a format based on the value of another variable.

Example Features

Featured StepPROC FORMAT and DATA step
Featured Step Options and StatementsCATX, PUT, and PUTN functions

Input Data Set

Data set GLOBAL_REVENUE contains annual revenue results from several countries. Values from the USA and Canada are dollars. Values from Belgium, France, and Germany are euros. Values from Japan are yen.


             Obs    country    year         revenue 1 USA 2008 3819501.03 2 USA 2009 -19391.88 3 USA 2010 1033.65 4 Canada 2008 471868.81 5 Canada 2009 297654.01 6 Canada 2010 111123.09 7 Belgium 2008 -1201.30 8 Belgium 2009 404019.87 9 Belgium ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.