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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.