BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Fluorite | Level 6

Hello everyone,

I think most of you aware of a format COMMAw.d which prints number, say, 123456789.12 as


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';


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).


Accepted Solutions
Tourmaline | Level 20

For your second alternative, it could be accomplished using the nlnum. format, just be sure to have the appropriate locale set.

Data never sleeps

View solution in original post

Tourmaline | Level 20

For your second alternative, it could be accomplished using the nlnum. format, just be sure to have the appropriate locale set.

Data never sleeps
Fluorite | Level 6

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.

Tourmaline | Level 20

Sweden has blanks... (sv_SE)

Data never sleeps
Fluorite | Level 6


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!

Quartz | Level 8

A couple of things to note

  1. Windows and Unix SAS (unless I blinked and missed the upgrade) use the IEEE system of representing floating point numbers in 8 bytes.  This restricts the accuracy of representing any integer to just short of 16 digits.  MS Excel has the same limitation - try entering a 16 digit number and it will truncate the last digit to zero.  SAS is better behaved but anything after the first 15 digits in your format cannot be relied on. 
  2. Picture formats with decimals do not round to nearest decimal.  Instead they always round down.  This can catch you out because what looks like 12345.6700 when you view your table using best12.4 may be a tiny amount short of that and picture would represent it as 12345.6699.

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

Fluorite | Level 6

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.


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.


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.


Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 3 in conversation