<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Making changes to values in SQL Server table based on records in SAS table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Making-changes-to-values-in-SQL-Server-table-based-on-records-in/m-p/803200#M316266</link>
    <description>&lt;P&gt;I have a SAS table that is a subset of records (10 records) from a SQL Server table (20,837 records). I need to update the value of a column in the SQL Server table, but only for the records that also exist in my aforementioned SAS table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifically, if the record exists in the SAS table, then change the HISTORY_DATE value in the SQL Server table to today's date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the cleanest way to do this?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Mar 2022 18:56:22 GMT</pubDate>
    <dc:creator>holcoje</dc:creator>
    <dc:date>2022-03-21T18:56:22Z</dc:date>
    <item>
      <title>Making changes to values in SQL Server table based on records in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-changes-to-values-in-SQL-Server-table-based-on-records-in/m-p/803200#M316266</link>
      <description>&lt;P&gt;I have a SAS table that is a subset of records (10 records) from a SQL Server table (20,837 records). I need to update the value of a column in the SQL Server table, but only for the records that also exist in my aforementioned SAS table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifically, if the record exists in the SAS table, then change the HISTORY_DATE value in the SQL Server table to today's date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the cleanest way to do this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 18:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-changes-to-values-in-SQL-Server-table-based-on-records-in/m-p/803200#M316266</guid>
      <dc:creator>holcoje</dc:creator>
      <dc:date>2022-03-21T18:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Making changes to values in SQL Server table based on records in SAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-changes-to-values-in-SQL-Server-table-based-on-records-in/m-p/803212#M316270</link>
      <description>&lt;P&gt;Is this going to be a&amp;nbsp; regular process or is it just a one-off? If the number of records stays quite low then building a WHERE statement using a macro variable is probably easiest:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname SQLSRVR odbc noprompt = "server=SQLServerName;DRIVER=SQL Server Native Client 11.0;Trusted Connection=yes" DATABASE = MyDatabase schema = dbo;

proc sql;
  select quote(Key_Var) 
  into :Key_Var_List separated by "," 
  from SAS_Table;
quit;

proc sql;
 connect using SQLSRVR;
  execute(
  update table Want
  Date_Var = '20220322'
  where Key_Var in (&amp;amp;Key_Var_List)
  ) by SQLSRVR;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Mar 2022 19:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-changes-to-values-in-SQL-Server-table-based-on-records-in/m-p/803212#M316270</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-03-21T19:47:00Z</dc:date>
    </item>
  </channel>
</rss>

