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
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;
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
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).
I'll submit a Problem Report as soon as someone confirms that the bug still exists in 9.4.
We just upgraded to 9.3 so 9.4 is a long way off for us
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?
Message was edited by: 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;
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?
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
Please, some 9.4 pioneer, run the test ! - - PG
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.
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;
'tis a pity there is no way a picture provides "floating" decimals
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.