BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ssafmed
Obsidian | Level 7

Hi,

 

I want to use Picture FORMAT  to have the output in file like : -0000000000.0000000000  (the first one is for sign(if it's positiv it last empty but if it's negativ it's -) and ten zeros then dot then ten 0 It's 22 in total) 

I use this format but I get ERROR: Number of digit selectors (17)cannot exceed 16

picture ving
LOW-<0 = '9999999999.9999999999' (prefix='-')
0-HIGH = '9999999999.9999999999'
other = .
;

Like this :

picture.png

Can u please help to solve this issue 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

So use a normal VALUE statement instead and combine it with the -R modifier on the format specification (ving22.-R).

 

Example:

3616  proc format cntlout=xxx ;
3617  picture ving (default=22 )
3618  LOW-<0 = [Z22.10]
3619  0-HIGH = [Z21.10]
3620  other = '           .          '
3621  ;
NOTE: Format VING is already on the library WORK.FORMATS.
NOTE: Format VING has been output.
3622

NOTE: The data set WORK.XXX has 3 observations and 21 variables.
NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


3623  data _null_;
3624    do x=0,1,-1,1E9,-1E9,1e-10,-1e-10;
3625      put x ving22.-r +1 x= ;
3626    end;
3627  run;

 0000000000.0000000000 x=0
 0000000001.0000000000 x=1
-0000000001.0000000000 x=-1
 1000000000.0000000000 x=1000000000
-1000000000.0000000000 x=-1000000000
 0000000000.0000000001 x=1E-10
-0000000000.0000000001 x=-1E-10
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26
I think the error message is clear. You need to remove a digit somewhere. You can also try the BESTw.d format or the w.d format.
--
Paige Miller
sbxkoenk
SAS Super FREQ

Hello,


I'm afraid you have hit a limit on the number of digit selectors in a picture format.

ERROR: Number of digit selectors (17) cannot exceed 16.

Unfortunately 16 is the maximum number of digits you can have in a picture format.
This one is a precision thing. For numerics, SAS is only able to hold 16 digits (17 digits for EBCDIC machines), before precision is lost. So Proc Format was designed to reflect this.
Obviously, SAS can hold bigger numbers (eg format 24.2), which it stores internally in floating point.
Proc Format is for display, and you are limited to 16 displayable chars maximum.

Regards,
Koen

Tom
Super User Tom
Super User

How is that any different than using 23.10 format?

3504  data _null_;
3505    do x=0,1,-1,1E10,-1E10,1e-10,-1e-10;
3506      put x 23.10 +1 x= ;
3507    end;
3508  run;

           0.0000000000 x=0
           1.0000000000 x=1
          -1.0000000000 x=-1
 10000000000.0000000000 x=10000000000
-10000000000.0000000000 x=-10000000000
           0.0000000001 x=1E-10
          -0.0000000001 x=-1E-10

 Or perhaps the Z23.10 format?

3509  data _null_;
3510    do x=0,1,-1,1E10,-1E10,1e-10,-1e-10;
3511      put x Z23.10 +1 x= ;
3512    end;
3513  run;

000000000000.0000000000 x=0
000000000001.0000000000 x=1
-00000000001.0000000000 x=-1
010000000000.0000000000 x=10000000000
-10000000000.0000000000 x=-10000000000
000000000000.0000000001 x=1E-10
-00000000000.0000000001 x=-1E-10
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
ssafmed
Obsidian | Level 7

What I need is this:

 

picture.png

 

If it's positiv its empty

 

Thanks!

Tom
Super User Tom
Super User

So use a normal VALUE statement instead and combine it with the -R modifier on the format specification (ving22.-R).

 

Example:

3616  proc format cntlout=xxx ;
3617  picture ving (default=22 )
3618  LOW-<0 = [Z22.10]
3619  0-HIGH = [Z21.10]
3620  other = '           .          '
3621  ;
NOTE: Format VING is already on the library WORK.FORMATS.
NOTE: Format VING has been output.
3622

NOTE: The data set WORK.XXX has 3 observations and 21 variables.
NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


3623  data _null_;
3624    do x=0,1,-1,1E9,-1E9,1e-10,-1e-10;
3625      put x ving22.-r +1 x= ;
3626    end;
3627  run;

 0000000000.0000000000 x=0
 0000000001.0000000000 x=1
-0000000001.0000000000 x=-1
 1000000000.0000000000 x=1000000000
-1000000000.0000000000 x=-1000000000
 0000000000.0000000001 x=1E-10
-0000000000.0000000001 x=-1E-10
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
ssafmed
Obsidian | Level 7
Thanks!

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

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
  • 1211 views
  • 6 likes
  • 4 in conversation