I have some monetary data that could have diffrent length. (Ex. with a format of 10.2, I could have 1234.56 or 1234567.89)
I know that I can right align that by converting to char and add some zeros depending on the value - that's not what I want.
Actually, If I don't want all these extra zeros to appear, then the values are not right aligned.
So, how can I print the real number (with no extra zero) AND right align that.
Thanks
Numeric data is right align default.
If you use a format in data _null_ to print data , the number will be right align.
data x; input x 10.2; cards; 1234.56 1234567.89 ;run; data _null_; set x; put x best10.2; run;
Ksharp
If you're printing the data using proc report can you use align=right?
Actually, I use a data _null_ . Is there a way to do it with a Data?
What are you outputting it to?
@Reeza : In my outfile, I put a report that contains some totals for the different types of record I read from my infile.
@rtritz : Thanks, I'll try it.
Mike018
use a format in the PUT statement in your data _null_ step.
peterC
One possibility is to convert the numeric data to character and use the right function which will right align character variables in the data cell by adding blanks not zeros.
Rich
Numeric data is right align default.
If you use a format in data _null_ to print data , the number will be right align.
data x; input x 10.2; cards; 1234.56 1234567.89 ;run; data _null_; set x; put x best10.2; run;
Ksharp
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.