title: Sql to proc sql conversion
body: <p>I have 2 tables that contains var values like (ID, date, var1,var2,var3....)</p>
  
  <p>I need to get the data from table2 and add it to table1 for which (ID or date) does not exist in table1.</p>
  
  <p>I am using the below code in sql to get new ID's from tab2 to tab1:</p>
  
  <pre><code>INSERT INTO table1
  SELECT * FROM table2 a
  WHERE ID not in(select ID from table1 where ID=a.ID)
  </code></pre>
  
  <p>Here is the code to add new date for existing ID's in tab2 to tab1 :</p>
  
  <pre><code>INSERT INTO table1
      SELECT * FROM table2 a
      WHERE date not in(select date from table1 where ID=a.ID)
  </code></pre>
  
  <p>I don't know how to do this in proc sql.
  Please share an effective method to do this task.</p>
  
  <p>To insert the new ID I used:</p>
  
  <pre><code>proc sql;
  create table lookup as
  select a.ID
  from table1 a inner join table2 b
    on a.ID = b.ID
  ;
  insert into table1 
  select * from table2 a
  where a.ID not in (select ID from lookup)
  ;
  quit;
  </code></pre>
  
  <p>This works well. But, it failed to insert a date for existing IDs.
  Please suggest some ideas to complete this step.
  Thanks in advance!</p>