Desktop productivity for business analysts and programmers

Custom numeric format left aligns

Reply
Frequent Contributor
Posts: 97

Custom numeric format left aligns

I am using this custom format to replace the missing values of a column with 0.00

On doing this the values 0.00 gets left aligned.

1. How to get them right aligned along with the other values.
2. Is there any other way by which we can replace the missing values with 0.00 and should appear as right aligned when used in proce report



data work.Test;
input code $ sales 10.2;
datalines;
A1001 2500.25
A1002 3500
A1003 .
A1004 0.4
run;

proc format;
value abc .= 0.00 other=[comma12.2];
run;

proc report data=Work.Test;
column code sales;
define sales / display format=abc. ;
run;
Frequent Contributor
Posts: 97

Re: Custom numeric format left aligns

Can somebody reply please
SAS Super FREQ
Posts: 8,819

Re: Custom numeric format left aligns

Hi:
Partly the answer depends on your destination of choice. You can use this syntax for RTF, PDF and HTML:
[pre]
define sales / display format=abc.
style(column)={just=r};
[/pre]

but the downside is that this syntax won't work for LISTING.

One solution that would work for all destinations, including LISTING, would be to add a compute block to your code:
[pre]
* USAGE=DISPLAY;
compute sales;
if sales = . then sales = 0.00;
endcomp;
OR
*USAGE=SUM or default usage is used;
compute sales;
if sales.sum = . then sales.sum = 0.00;
endcomp;
[/pre]

If you need help faster than people on the forum respond, your best bet for a quick response is to contact Tech Support.

cynthia
Ask a Question
Discussion stats
  • 2 replies
  • 160 views
  • 0 likes
  • 2 in conversation