Hi,
I have a simple cntlin based proc format defined and it is choking when trying to define it. For the life of me I can't see what it is.
The data is:
Obs EEXCL FUZZ fmtname type start end label hlo
1 Y 1E-12 binfmt N 0.50 0.55 50.0% to 54.9% L
2 Y 1E-12 binfmt N 0.55 0.60 55.0% to 59.9%
3 Y 1E-12 binfmt N 0.60 0.65 60.0% to 64.9%
4 Y 1E-12 binfmt N 0.65 0.70 65.0% to 69.9%
5 Y 1E-12 binfmt N 0.70 0.75 70.0% to 74.9%
6 Y 1E-12 binfmt N 0.75 0.80 75.0% to 79.9% H
and running this into proc format, the error I get is:
2 proc format cntlin=temp.binfmt;
ERROR: These two ranges overlap: LOW-<0.55 and 0.55-<0.6 (fuzz=1E-12).
ERROR: These two ranges overlap: 0.6-<0.65 and 0.65-<0.7 (fuzz=1E-12).
2 ! run;
What have I overlooked? I did set the fuzz to .0001 with no change.
Thanks much!
--Ben
Have you tried it with fuzz=0? (I always use that - any other is problematic)
The error has nothing to do with fuzz, it has to do with defined ranges.
Because you did not set the SEXCL or EEXCL variables, which say to Start exclude (N is default) or End Exclude (N is default) but you want a Y for the end then the end values were included in all of the ranges.
Look at the output set Work.cntlout from this code:
proc format library=work cntlout=work.cntlout; value binfmt .5 - <.55 = '50% to 54.9%' .55 - .6 = '55% to 59.6%' ; run;
to see. The same thing is happening with the .65 value
I've just run this code and it worked fine. Is there something else in your original code you may have overlooked?
data cntl;
infile cards firstobs=2 dsd dlm=' ';
attrib eexcl type length=$ 1;
attrib fuzz informat=best. format=best.;
attrib fmtname length=$ 8;
attrib start end length=8 format=best.;
attrib label length=$ 30;
attrib hlo length=$ 1;
input eexcl
fuzz
fmtname
type
start
end
label
hlo;
cards;
EEXCL FUZZ fmtname type start end label hlo
Y 1E-12 binfmt N 0.50 0.55 "50.0% to 54.9%" L
Y 1E-12 binfmt N 0.55 0.60 "55.0% to 59.9%"
Y 1E-12 binfmt N 0.60 0.65 "60.0% to 64.9%"
Y 1E-12 binfmt N 0.65 0.70 "65.0% to 69.9%"
Y 1E-12 binfmt N 0.70 0.75 "70.0% to 74.9%"
Y 1E-12 binfmt N 0.75 0.80 "75.0% to 79.9%" H
;
run;
proc format cntlin=cntl;
run;
proc format fmtlib;
select binfmt;
run;
Wow. That's just bizarre.
11 proc print data=temp.binfmt;
12 run;
NOTE: There were 6 observations read from the data set TEMP.BINFMT.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
13
14 proc format cntlin=temp.binfmt;
ERROR: These two ranges overlap: LOW-<0.55 and 0.55-<0.6 (fuzz=1E-12).
ERROR: These two ranges overlap: 0.6-<0.65 and 0.65-<0.7 (fuzz=1E-12).
14 ! run;
WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 6 observations read from the data set TEMP.BINFMT.
And the output from the proc print:
The SAS System 13:21 Monday, February 6, 2017 2
Obs EEXCL FUZZ fmtname type start end label hlo
1 Y 1E-12 binfmt N 0.50 0.55 50.0% to 54.9% L
2 Y 1E-12 binfmt N 0.55 0.60 55.0% to 59.9%
3 Y 1E-12 binfmt N 0.60 0.65 60.0% to 64.9%
4 Y 1E-12 binfmt N 0.65 0.70 65.0% to 69.9%
5 Y 1E-12 binfmt N 0.70 0.75 70.0% to 74.9%
6 Y 1E-12 binfmt N 0.75 0.80 75.0% to 79.9% H
Am running on 9.4 TS1M3 on a 64 bit server. ?
--Ben
Can you try running this:
proc format lib=work;
value binfmt(fuzz=1E-12 min=1 max=40)
LOW -< 0.55 = "50.0% to 54.9%"
0.55 -< 0.6 = "55.0% to 59.9%"
0.6 -< 0.65 = "60.0% to 64.9%"
0.65 -< 0.7 = "65.0% to 69.9%"
0.7 -< 0.75 = "70.0% to 74.9%"
0.75 -< HIGH = "75.0% to 79.9%"
;
run;
I took the format that I created it and ran it through my reverse-engineering macro %genfmt. It takes an existing format and creates the code that could have been used to create it.
If this doesn't work in your environment, there may be some weird option setting which is overriding your requirements.
Use the instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to make datastep code of your data set and paste that here in a code box opened with {i} icon. There may be something else happening that is not obvious with the way you are pasting your data.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.