title: How to use SAS hash object ?
body: <p>I tried to define a key in SAS hash object . But got error . Here is the code : </p>
  
  <pre><code>data sasuser.contrib ; 
  input empid $ qtrnum $ amount ;          
  datalines;
  e2 qtr1 11 
  e3 qtr2 12 
  e4 qtr3 13 
  e5 qtr4 14 
  e6 qtr1 15 
  ;
  run; 
  
  data difference (drop = goalamount);
  length goalamount 8; 
  if _N_ = 1 then do;                           
  declare hash goal(); 
  goal.definekey ("QtrNum") ; 
  goal.definekey ("GoalAmount") ; 
  goal.definedone() ;                         
  call missing(qtrnum, goalamount) ;       
  goal.add(key : 'qtr1' , data : 10 ) ;        
  goal.add(key : 'qtr2' , data : 15 ) ;     
  goal.add(key : 'qtr3' , data : 5  ) ; 
  goal.add(key : 'qtr4' , data : 15 ) ;   
  end;  
  set sasuser.contrib ;  
  goal.find() ;  
  diff = amount - goalamount;   
  run  ;   
  </code></pre>
  
  <p>The error is <code>ERROR: Variable qtrnum has been defined as both character and numeric</code>  </p>
  
  <p>I tried removing the set statement, but still could not debug it . How can I improve my code ?  </p>