The SAS Output Delivery System and reporting techniques

Proc Template to Justify by Variable Type

Frequent Contributor
Posts: 82

Proc Template to Justify by Variable Type

Is there a way, within a template, to specify ODS to justify character data differently from numeric data? If left to default, character is left and numeric is right. However, since justify=on for most destinations, my decimals are not lined up. I would like to specify all numeric data to be just=d without affecting my character variables. Setting

parent = styles.printer;
replace Data from Cell "Default style for data cells in columns." /
just = d;

causes my character data to all be right justified.

SAS Employee
Posts: 16

Re: Proc Template to Justify by Variable Type

In 9.2 there is the capability of aligning columns based on their data type. There is a table template called Base.Template.Table that all table templates inherit from. If you define that table template as follows, it should do what you want.

proc template;
define table base.template.table;
cellstyle _datatype_ = 'num' as {just=d};

This doesn't apply to Proc Tabulate, Proc Report, or Proc Print though because they do not use table templates.
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation