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

I am using the dataset to create the formats and in that I have coded values itself has "LOW", "HIGH" when i create formats out of it I am getting error "ERROR: These two ranges overlap: ". I gave the Type also as "C" to consider as character format but still sas is treating "LOW" /"HIGH" as key words and treating as range..Kindly help to resolve this. Below is an example dataset created to explain for example. Is there a way to mask this? For all others I am able to create the formats without any issues.

/****************************************/
data fmt;
retain fmtname "$NRIND";
length start $100. label $100.;
start = "ABNORMAL";
label = "abnormal";
type = "C";
output;
start = "NORMAL";
label = "normal";
type = "C";
output;
start = "HIGH";
label = "high";
type = "C";
output;
start = "LOW";
label = "low";
type = "C";
output;
run;

proc format cntlin=fmt;
run;

 

/****************log************/

97 proc format cntlin=fmt;
ERROR: These two ranges overlap: LOW-LOW and ABNORMAL-ABNORMAL (fuzz=0).
ERROR: These two ranges overlap: HIGH-HIGH and NORMAL-NORMAL (fuzz=0).
98 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.00 seconds
cpu time 0.00 seconds

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Add the HLO variable, so that it becomes clear these are not the usual HIGH and LOW values:

data fmt;
retain
  fmtname "$NRIND"
  type "C"
  hlo ""
;
length start $10. label $10.;
input start label;
datalines;
ABNORMAL abnormal
NORMAL normal
HIGH high
LOW low
;

proc format cntlin=fmt;
run;

Log:

 73         data fmt;
 74         retain
 75           fmtname "$NRIND"
 76           type "C"
 77           hlo ""
 78         ;
 79         length start $10. label $10.;
 80         input start label;
 81         datalines;
 
 NOTE: The data set WORK.FMT has 4 observations and 5 variables.
 NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 86         ;
 87         
 88         proc format cntlin=fmt;
 NOTE: Format $NRIND is already on the library WORK.FORMATS.
 NOTE: Format $NRIND has been output.
 89         run;

View solution in original post

7 REPLIES 7
Kurt_Bremser
Super User

Don't use DATATYPE, you don't need it here, and it has a special function.

data fmt;
retain
  fmtname "$NRIND"
  type "C"
;
length start $10. label $10.;
input start label;
datalines;
ABNORMAL abnormal
NORMAL normal
HIGH high
LOW low
;
Bala_SD
Calcite | Level 5
Thanks for the reply.. The problem is in the procedure creating the formats.. I tried creating the dataset as you suggested, but still getting the same error.

117 data fmt;
118 retain
119 fmtname "$NRIND"
120 type "C"
121 ;
122 length start $10. label $10.;
123 input start label;
124 datalines;

NOTE: The data set WORK.FMT has 4 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds


129 ;
130 run;
131
132
133 proc format cntlin=fmt;
ERROR: These two ranges overlap: LOW-LOW and ABNORMAL-ABNORMAL (fuzz=0).
ERROR: These two ranges overlap: HIGH-HIGH and NORMAL-NORMAL (fuzz=0).
134 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.00 seconds
cpu time 0.00 seconds
Kurt_Bremser
Super User

Add the HLO variable, so that it becomes clear these are not the usual HIGH and LOW values:

data fmt;
retain
  fmtname "$NRIND"
  type "C"
  hlo ""
;
length start $10. label $10.;
input start label;
datalines;
ABNORMAL abnormal
NORMAL normal
HIGH high
LOW low
;

proc format cntlin=fmt;
run;

Log:

 73         data fmt;
 74         retain
 75           fmtname "$NRIND"
 76           type "C"
 77           hlo ""
 78         ;
 79         length start $10. label $10.;
 80         input start label;
 81         datalines;
 
 NOTE: The data set WORK.FMT has 4 observations and 5 variables.
 NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 86         ;
 87         
 88         proc format cntlin=fmt;
 NOTE: Format $NRIND is already on the library WORK.FORMATS.
 NOTE: Format $NRIND has been output.
 89         run;
Bala_SD
Calcite | Level 5
Thanks for the solution
Shmuel
Garnet | Level 18

LOW and HIGH are reserved word of format procedure, usually used as:

LOW - <value1>

<valuen> - HIGH

that the reason you got the These two ranges overlap:

     "These two ranges overlap:" error messages.

 

Beyond, I had never used the DATATYPE= variable and you can omit it.

As @Kurt_Bremser have shown you can add the TYPE to the RETAIN statement.

Bala_SD
Calcite | Level 5
Thanks for the reply. Datatype I just used for checking and without removing it i posted here. Yes it is treating "LOW"/"HIGH" as a reserved word only when i create formats from datasets using cntlin.. but if i create seperate format using the usual way it is not treating it as a reserved word and format is created without any issues.. So is there any way to mask this considering as a reserved word and consider to treat as just text while using cntlin ?
proc format;
value $NRIND
"ABNORMAL" = "abnormal"
"NORMAL" = "normal"
"HIGH"="high"
"LOW"= "low"
;
run;
mitiksh
Fluorite | Level 6

Do it like this it will work

data test_fmt;
length label $15;
fmtname='range';
input start $ end $ label :$;
datalines;
LOW 20 "good"
21 high "excellent"
other . "missing"
;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 7 replies
  • 1593 views
  • 3 likes
  • 4 in conversation