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

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
1 ACCEPTED SOLUTION

Accepted Solutions
Peter_C
Rhodochrosite | Level 12

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

13 REPLIES 13
FriedEgg
SAS Employee

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

Kurt_Bremser
Super User

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

PGStats
Opal | Level 21

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

PG
Reeza
Super User

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

data_null__
Jade | Level 19

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_

FriedEgg
SAS Employee

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;

data_null__
Jade | Level 19

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?

PGStats
Opal | Level 21

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
PGStats
Opal | Level 21

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

PG
FriedEgg
SAS Employee

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.

Peter_C
Rhodochrosite | Level 12

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;

PGStats
Opal | Level 21

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

PG
Peter_C
Rhodochrosite | Level 12

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 13 replies
  • 1365 views
  • 6 likes
  • 6 in conversation