BookmarkSubscribeRSS Feed
SanjayM
Calcite | Level 5
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;
2 REPLIES 2
SanjayM
Calcite | Level 5
Can somebody reply please
Cynthia_sas
Diamond | Level 26
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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1325 views
  • 0 likes
  • 2 in conversation