/**********************************************************************/


libname library '
                 /* SAS-data-library */
                                       ';
proc format library=library;                

   /* SAS statements creating format */   

run;                                        


/**********************************************************************/


proc format cntlin=
                   /* SAS-data-set */
                                     ;


/**********************************************************************/


data custfile;                                         
   retain fmtname 'custfmt'                            
          type    'c';                                 
   set customer (rename=(custid=start custname=label));
run;

                                                   
/**********************************************************************/


proc print data=custfile;
run;                     


/**********************************************************************/


libname library '
                 /* SAS-data-library */
                                       ';
proc format library=library cntlin=custfile;
run;                                        


/**********************************************************************/


format custid $custfmt.;


/**********************************************************************/


retain fmtname 'large' sexcl 'y';


/**********************************************************************/


length start end $ 4 label $ 12;



/**********************************************************************/


start = ' low'; 
hlo   = 'l';    
end   = '   0'; 
label = '     <=    0';
output;                


/**********************************************************************/


hlo  = ' ';                       
do i = 100 to 5000 by 100;        
   start = put(i-100,4.);         
   end   = put(i,4.);             
   label = start || ' <= ' || end;
   output;                        
end;                              


/**********************************************************************/


start = '5000';  
hlo   = 'h';     
end   = 'high';  
label = '5000 <';
output;          


/**********************************************************************/


data control (drop=i);                
   retain fmtname 'large'  sexcl 'y'; 
   length start end $ 4 label $ 12;   
   start = ' low';                    
   hlo   = 'l';                       
   end   = '   0';                    
   label = '     <=    0';            
   output;                            
   hlo   = ' ';                       
   do i = 100 to 5000 by 100;         
      start = put(i-100,4.);          
      end  = put(i,4.);               
      label = start || ' <= ' || end; 
      output;                         
   end;                               
   start = '5000';                    
   hlo   = 'h';                       
   end   = 'high';                    
   label = '5000 <';                  
   output;
run;      


/**********************************************************************/


proc print data=control;                 
   var fmtname start end label sexcl hlo;
run;                                     


/**********************************************************************/


libname library '         
                 /* SAS-data-library */
                                       ';
proc format library=library cntlin=control;         
   value temp   low - < 98.6 = 'below normal' 
                        98.6 = 'normal'             
                 98.6 - high = 'above normal';
run;                                                


/**********************************************************************/


libname library '
                 /* SAS-data-library */
                                       ';                                        
proc format library=library fmtlib;        
   select large;                           
run;                                       


/**********************************************************************/