Hello everyone,
I think most of you aware of a format COMMAw.d which prints number, say, 123456789.12 as
123,456,789.12
I'm trying to find quite similiar format which will print the same number in a manner
123 456 789.12
or even
123 456 789,12
Since I haven't find built in one I tried to create picture by myself using proc format
proc format;
picture test low-high='00 000 000 000 000.00';
run;o
Okay, it seems to work for the number I chose, but what about 20 digit length numbers?
According to SAS Help, I can't use picture string with more than 16 digits.
What to do in this situation? (P.s. Comma. format works fine with up to 40 digits).
For your second alternative, it could be accomplished using the nlnum. format, just be sure to have the appropriate locale set.
For your second alternative, it could be accomplished using the nlnum. format, just be sure to have the appropriate locale set.
Any hint about specific locale?
I have Russia_Russian, but it's still uses comma as a 3digit separator, and I need a blank space.
Sweden has blanks... (sv_SE)
Thanks!
I wonder why Russian has commas... It's a question for SAS support: it must be blanks for digit separating and a comma for decimal.
upd. I used NLNUM. instead of NLNUMI for my locale. And it worked.
LinusH, thanks anyway!
A couple of things to note
Oracle uses a 12 byte internal representation for numeric values so you commonly see 23 digits specified. I believe you can have extended precision in FORTRAN, if that helps.
Richard in Oz
Richard, thanks!
I've totally forgot about the 8 byte limitation for floats... Despite of seeing this fact in every computer science course I've ever taken.
Actually, I don't really need such an accuracy, I just need the format that will be universal (like any internal format).
So I can use it with numbers of different power (assuming the power of a column is the same through the dataset).
I.e. when I'm using a picture for the format, the number of digit selectors must be 16, but the place of decimal separator "." is predefined.
And that's a problem, because for different powers of the number (that I want to print) I'll need to redefine the format in order to have 16 digits and a "." in appropriate place.
Example:
1234567890.123456 and 123456789012345.6
I can use CommaW.D to set the correct formatting (without using the redifinition of format).
I can't use any picture created by proc format, because in both numbers, independently of (w.d), some part will be truncated.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.