Help using Base SAS procedures

SAS aborts on PICTURE format definition

Accepted Solution Solved
Reply
Respected Advisor
Posts: 4,920
Accepted Solution

SAS aborts on PICTURE format definition

Hi, I'm using SAS 9.3 TS1M2 on Windows 7 32bits. The following code

proc format;

picture signPrefix 0 - high = [best10.] (prefix='+');

run;

causes SAS to abort. It runs fine when the picture option is removed.

1) Does it abort other SAS versions?

2) Should the format definition be accepted or result in an error?

PG

PG

Accepted Solutions
Solution
‎05-23-2014 01:27 PM
Valued Guide
Posts: 2,177

Re: SAS aborts on PICTURE format definition

SAS9.4 on Win7-64

1    proc format;

2    picture signPrefix 0 - high = [best10.] (prefix='+');

ERROR: PICTURE options NOEDIT, FILL=, PREFIX=, and MULT= cannot be used with formats-as-labels or functions-as-labels.

NOTE: The previous statement has been deleted.

3    run;

View solution in original post


All Replies
Trusted Advisor
Posts: 1,301

Re: SAS aborts on PICTURE format definition

It crashes my instance as well.  However, stranger is that fact that if I add another arbitrary format specification before this one, it will work fine.

proc format;

picture foo (default=7) low-high='000.000';

picture signPrefix 0 - high = [best10.] (prefix='+');

run;



Message was edited by: FriedEgg

Forgot to note, I was using 9.3TS1M1 on Windows Server, 64bit

Super User
Posts: 7,764

Re: SAS aborts on PICTURE format definition

As soon as SAS terminates without a "normal" error message, it is surely a case for technical support.

FriedEgg's answer makes this look even more like a real bug in the SAS system's code itself (some kind of unitialized var / bad pointer thing).

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Respected Advisor
Posts: 4,920

Re: SAS aborts on PICTURE format definition

Posted in reply to KurtBremser

I'll submit a Problem Report as soon as someone confirms that the bug still exists in 9.4.

PG
Super User
Posts: 19,772

Re: SAS aborts on PICTURE format definition

We just upgraded to 9.3 so 9.4 is a long way off for us Smiley Sad

Respected Advisor
Posts: 3,799

Re: SAS aborts on PICTURE format definition

Crashes my unix 9.3 as well.  Prefix is incompatible with range=[format] so it ain't gonna work anyway.

The results below are interesting and I reckon unexpected (but maybe not if you think about the "right" way) as the second prefix is applied to the first range.  Does SAS have a leading sign best style format?


proc format cntlout=cntl;
   picture signPrefix  low-<0=' 0.9999999999'(prefix='-') 0-high=[best10.] (prefix='+');
   run;
data _null_;
  
do i = 1 to 20;
     
x = rannor(334);
      put x= x=signprefix.;
     
end;
  
run;

x=0.7081713327 x=0.70817133
x=-
0.710779582 x=+7107795818
x=-
0.045601584 x=+0456015843
x=-
1.238536535 x=+1.2385365349
x=
0.1009037824 x=0.10090378
x=
0.9107126472 x=0.91071265
x=-
2.418964018 x=+2.4189640175
x=-
0.075013327 x=+0750133265
x=-
2.238207142 x=+2.2382071415
x=-
0.963393355 x=+9633933546
x=
0.3429036945 x=0.34290369
x=
0.9882564005 x=0.9882564
x=
0.0647758758 x=0.06477588
x=
0.1570609235 x=0.15706092
x=
0.9190866369 x=0.91908664
x=
0.4440814958 x=0.4440815
x=-
1.247483514 x=+1.2474835136
x=-
0.046558305 x=+0465583050
x=
0.2561687776 x=0.25616878
x=
0.1763276708 x=0.17632767

I should have used 9 as my first digit selector to print the leading zero and the message character "."
However that illustrates another interesting feature of PICTURE formats.

Message was edited by: data _null_

Trusted Advisor
Posts: 1,301

Re: SAS aborts on PICTURE format definition

Posted in reply to data_null__

I get a similar error if I try to create a format using cntlin (even without a prefix):

data picture;

fmtname='ds';

*default=40;

type='p';

start='';

end='';

label='best10.';

hlo='of';

*prefix='+';

run;

proc format cntlin=picture cntlout=x; run;

Respected Advisor
Posts: 3,799

Re: SAS aborts on PICTURE format definition

This works on my 9.3 unix.  But what's the point of PICTURE with no pictures..

How do you make a leading +sign best style format?

Respected Advisor
Posts: 4,920

Re: SAS aborts on PICTURE format definition

Posted in reply to data_null__

With FCMP I guess:

proc fcmp outlib=sasuser.fcmp.formats;

function signPrefix(x) $32;

       if x > 0 then return(cats("+",x));

       else return (cats(x));

endsub;

run;

options cmplib=sasuser.fcmp;

proc format;

value signPrefix (default=13 min=13) other=[signPrefix()];

run;

data _null_;

do x = -125.32, ., -0.001234, 0, 0.000123456, 123, 12346768.123455676;

       put x= x=signPrefix.;

       end;

run;

PG

PG
Respected Advisor
Posts: 4,920

Re: SAS aborts on PICTURE format definition

Please, some 9.4 pioneer, run the test ! - Smiley Happy -  PG

PG
Trusted Advisor
Posts: 1,301

Re: SAS aborts on PICTURE format definition

I have been holding off until the 9.4M2 release (supposedly in July), since 9.4 will also require I update to RHEL6, which is why I have been putting it off.

Solution
‎05-23-2014 01:27 PM
Valued Guide
Posts: 2,177

Re: SAS aborts on PICTURE format definition

SAS9.4 on Win7-64

1    proc format;

2    picture signPrefix 0 - high = [best10.] (prefix='+');

ERROR: PICTURE options NOEDIT, FILL=, PREFIX=, and MULT= cannot be used with formats-as-labels or functions-as-labels.

NOTE: The previous statement has been deleted.

3    run;

Respected Advisor
Posts: 4,920

Re: SAS aborts on PICTURE format definition

Thanks . The problem seems to be fixed in 9.4. - PG

PG
Valued Guide
Posts: 2,177

Re: SAS aborts on PICTURE format definition

'tis a pity there is no way a picture provides "floating" decimals

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 13 replies
  • 322 views
  • 6 likes
  • 6 in conversation