<?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 Re: Select only updated records and load the updated records in SQL table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637648#M189542</link>
    <description>&lt;P&gt;Your use case example doesn't make sense to me. It is impossible to change the attribute of a column - its length- for a single row. As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;has already stated, it has to change for all rows. So I see no need to create 2 rows for column 2 when no values in the row change at all between the 2. It would be different if the value changed from&amp;nbsp;121216 to say 12121689, but if that were to happen then you would have to modify the table schema and reload all of the data to accommodate the wider column.&lt;/P&gt;</description>
    <pubDate>Sun, 05 Apr 2020 05:56:01 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2020-04-05T05:56:01Z</dc:date>
    <item>
      <title>Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637531#M189498</link>
      <description>&lt;P&gt;We've a process where clients will update the file (say sales details) when there is a need and they intimate us about the change. So our job is to load those updated records to SQL DB table by maintaing the history.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the first time while loading the data to SQL we just did a 'proc append' to SQL table after reading the file via data step infile Statement. However this method will not work to track the history in SQL when there is a update in the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not Aware of SCDs as well.&amp;nbsp; We are not using any Primary/foreign key stuff in SQL.I would like to understand how I can tackle the situation to update the history. I tried with 'Proc SQL update' and 'If first. and last.' but it didn't helped either. Appericiate your help here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assume I've a file like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="width: 432pt; border-collapse: collapse;" border="0" width="576" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 54pt;" span="8" width="72" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD width="72" height="20" style="border: 0.5pt solid windowtext; width: 54pt; height: 15pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Id&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Name&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Sales&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Transaction&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Example Values&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Act_Ind&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Valid_From&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Valid_To&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" align="right" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; height: 14.25pt; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Unit&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;True&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;58001&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;19000101T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;99991231T235959&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" align="right" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; height: 14.25pt; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Key&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;True&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;121216&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;19000101T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;99991231T235959&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" align="right" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; height: 14.25pt; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Value&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;True&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;18&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;820595,2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;19000101T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;99991231T235959&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assume I've received an update to the file like this. If you notice Transaction value has changed for Key from 6 to 8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="width: 432pt; border-collapse: collapse;" border="0" width="576" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 54pt;" span="8" width="72" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD width="72" height="20" style="border: 0.5pt solid windowtext; width: 54pt; height: 15pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Id&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;Name&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Sales&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Transaction&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Example Values&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Act_Ind&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Valid_From&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="72" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Valid_To&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" align="right" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; height: 14.25pt; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Key&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;True&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;121216&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;20200404T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;99991231T235959&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So now I want data like this SQL table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="width: 432pt; border-collapse: collapse;" border="0" width="576" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 54pt;" span="8" width="72" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD width="40px" height="20" style="border: 0.5pt solid windowtext; width: 54pt; height: 15pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Id&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="59.2px" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;Name&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="52.8px" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Sales&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="100.8px" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Transaction&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="77.6px" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Example Values&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="69.6px" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Act_Ind&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Valid_From&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0.5pt 0.5pt 0.5pt 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext black; width: 54pt; background-color: transparent;"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Valid_To&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD width="40px" height="19" align="right" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; height: 14.25pt; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="59.2px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Unit&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="52.8px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;True&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="100.8px" align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="77.6px" align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;58001&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="69.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;19000101T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;99991231T235959&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD width="40px" height="19" align="right" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; height: 14.25pt; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="59.2px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Key&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="52.8px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;True&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="100.8px" align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;6&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="77.6px" align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;121216&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="69.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;N&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;19000101T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;20200403T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD width="40px" height="19" align="right" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; height: 14.25pt; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="59.2px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Key&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="52.8px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;True&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="100.8px" align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;8&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="77.6px" align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;121216&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="69.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;20200404T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;99991231T235959&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD width="40px" height="19" align="right" style="border-width: 0px 0.5pt 0.5pt; border-style: none solid solid; border-color: black windowtext windowtext; height: 14.25pt; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;3&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="59.2px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Value&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="52.8px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;True&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="100.8px" align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;18&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="77.6px" align="right" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;820595,2&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="69.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;19000101T000000&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="145.6px" style="border-width: 0px 0.5pt 0.5pt 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; background-color: transparent;"&gt;&lt;FONT color="#000000"&gt;99991231T235959&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 08:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637531#M189498</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-04-05T08:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637533#M189500</link>
      <description>&lt;P&gt;When column attributes that affect storage (length and/or type) change, you have to rewrite the whole table. In SAS and in a DBMS. And a column will have the same length throughout the whole table, period.&lt;/P&gt;
&lt;P&gt;I suggest you set up a change management process where changes in structure need to be approved by organization and planning, the department boss, and the IT boss. Just to make people think twice (or at least once, in many cases) before causing such a change.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Apr 2020 13:11:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637533#M189500</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-04T13:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637534#M189501</link>
      <description>Yes, we have a plan to set up a change management process in the future.&lt;BR /&gt;&lt;BR /&gt;However, as a first step we have to tackle this now in SQL table by&lt;BR /&gt;maintaining the history. Once we were able to do it, then we will rewrite&lt;BR /&gt;the table where attributes has changed.&lt;BR /&gt;&lt;BR /&gt;Could you please point me to any documents or to any examples which can&lt;BR /&gt;help me to accomplish this challenge?&lt;BR /&gt;</description>
      <pubDate>Sat, 04 Apr 2020 13:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637534#M189501</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-04-04T13:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637612#M189518</link>
      <description>&lt;P&gt;What is the question?&lt;/P&gt;
&lt;P&gt;Are you asking how to use the new record to calculate from the existing record:&lt;/P&gt;
&lt;PRE&gt;2	Key	char	6	121216	Y	19000101T000000	99991231T235959&lt;/PRE&gt;
&lt;P&gt;to the new records:&lt;/P&gt;
&lt;PRE&gt;2	Key	char	6	121216	N	19000101T000000	20200403T000000
2	Key	char	8	121216	Y	20200404T000000	99991231T235959&lt;/PRE&gt;
&lt;P&gt;?&amp;nbsp; PS Why doesn't the end timestamp get set to&amp;nbsp;20200403T235959 ?&lt;/P&gt;
&lt;P&gt;Or how to update the table once you know what changes to make?&lt;/P&gt;
&lt;P&gt;Looks to me like a simple way would be one of :&lt;/P&gt;
&lt;P&gt;- delete the existing record and insert the two new records.&lt;/P&gt;
&lt;P&gt;- change the status and end timestamp for the one existing record and insert one new record.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Apr 2020 19:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637612#M189518</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-04T19:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637616#M189521</link>
      <description>If there is any change to any field as I mentioned in my post then I have&lt;BR /&gt;to change the value from Y to N in Act_Ind (active indicator)variable and&lt;BR /&gt;time stamp in valid_to variable should have the value of current  date.&lt;BR /&gt;&lt;BR /&gt;In the new record I should have  the updated value for the variable  which&lt;BR /&gt;got changed followed by act_ind variable should have Y and valid_from&lt;BR /&gt;should have value (previous valid_to date+1) and valid_to should have&lt;BR /&gt;maximum end date as I shown in the example.&lt;BR /&gt;&lt;BR /&gt;I'm OK with any method (simple data step or SCD or ...)  to achieve this&lt;BR /&gt;task.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 04 Apr 2020 19:46:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637616#M189521</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-04-04T19:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637636#M189533</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;- This is a little off-topic but how are you dealing with a numeric column that could have a maximum of 18 digits when SAS numeric columns can only hold around 15 digits accurately?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Apr 2020 22:13:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637636#M189533</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-04-04T22:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637643#M189540</link>
      <description>It will be reduced to 15 in the future. Any thoughts to provide me the hint&lt;BR /&gt;to accomplish the challenge which I'm facing now?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 05 Apr 2020 03:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637643#M189540</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-04-05T03:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637648#M189542</link>
      <description>&lt;P&gt;Your use case example doesn't make sense to me. It is impossible to change the attribute of a column - its length- for a single row. As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;has already stated, it has to change for all rows. So I see no need to create 2 rows for column 2 when no values in the row change at all between the 2. It would be different if the value changed from&amp;nbsp;121216 to say 12121689, but if that were to happen then you would have to modify the table schema and reload all of the data to accommodate the wider column.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 05:56:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637648#M189542</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-04-05T05:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637660#M189546</link>
      <description>&lt;P&gt;As the received responses are off-topic, I've updated the initial post.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 08:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637660#M189546</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-04-05T08:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637681#M189559</link>
      <description>&lt;P&gt;OK, I seem to have misinterpreted your dataset structure.&lt;/P&gt;
&lt;P&gt;Please have a look at this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dlm='09'x dsd truncover;
input ID $ Name $ Sales $ Transaction :$2. Example_Values :$20. Act_Ind $ Valid_From :b8601dt16. Valid_To :b8601dt16.;
format Valid_From Valid_To b8601dt16.;
datalines;
1	Unit	True	6	58001	Y	19000101T000000	99991231T235959
2	Key	True	6	121216	Y	19000101T000000	99991231T235959
3	Value	True	18	820595,2	Y	19000101T000000	99991231T235959
;

data upd;
infile datalines dlm='09'x dsd truncover;
input ID $ Name $ Sales $ Transaction :$2. Example_Values :$20. Act_Ind $ Valid_From :b8601dt16. Valid_To :b8601dt16.;
format Valid_From Valid_To b8601dt16.;
datalines;
2	Key	True	8	121216	Y	20200404T000000	99991231T235959
;

proc compare
  base=have
  compare=upd
  out=comp
  outdif
  outnoequal
  noprint
;
by id;
run;

data realupd;
merge
  upd (in=a)
  comp (in=b keep=id)
;
by id;
if b;
run;

data new;
set
  have
  realupd (in=n)
;
by id;
if n
then new = 1;
else new = 0;
run;

data want;
merge 
  new
  new (firstobs=2 keep=id new valid_from rename=(id=_id valid_from=_vfrom new=_new))
;
if id = _id and _new
then valid_to = intnx('dtday',_vfrom,-1);
drop new _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Apr 2020 13:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637681#M189559</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-05T13:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637689#M189565</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Can you provide some comments to explain what those steps are doing? Can you explain why it works?&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 14:14:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637689#M189565</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-05T14:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637694#M189569</link>
      <description>&lt;P&gt;Good idea &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, I run a proc compare to identify observations that are &lt;EM&gt;really&lt;/EM&gt; new. Then I use the resulting dataset to extract those really new observations from the update dataset.&lt;/P&gt;
&lt;P&gt;Then I do an interleave (a set of multiple datasets with a by), and keep a new variable that tells me if I have a new observation added.&lt;/P&gt;
&lt;P&gt;In the final step, I do a look-ahead for the valid_from column and the new column. If I detect that the next observation is a new one for the current id, I overwrite the valid_to timestamp with a value 1 day before the valid_from of the added observation.&lt;/P&gt;
&lt;P&gt;This step also makes sure that a new id is added without further action.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Apr 2020 14:55:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637694#M189569</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-05T14:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637790#M189619</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Thanks for your code and it is working if the existing data is updated, but it seem to be not working when the new records are inserted. Also I don't want to restrict the 'by' clause only by id and therefore I tried with _all_ as shown below but I'm getting no records in the output after executing proc compare.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've a feel there might be slight changes are required in the code to handle all situations (new records inserted,any records deleted or existing records updated)&amp;nbsp;which I'm unable to figure out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; lib.sql_tbl;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _all_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; upd;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=upd;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _all_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;compare&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;base&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=have&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;compare&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=upd&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=comp&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;outdif&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;outnoequal&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;noprint&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _all_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; realupd;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;merge&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; upd (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=a)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; comp (&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;in&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=b &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_type_ _obs_)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _all_;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; b;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Log of proc compare:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;26         proc compare
27           base=have
28           compare=upd
29           out=comp
30           outdif
31           outnoequal
32           noprint
33         ;
34         by _all_;
35         run;

NOTE: Except for the 15 BY variables, the data sets WORK.HAVE and WORK.UPD have no variables in common. There are no matching 
      variables to compare. Comparisons of data values not performed.
NOTE: There were 99 observations read from the data set WORK.HAVE.
NOTE: There were 99 observations read from the data set WORK.UPD.
NOTE: The data set WORK.COMP has 0 observations and 17 variables.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 06:30:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637790#M189619</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-04-06T06:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637796#M189622</link>
      <description>&lt;P&gt;This is exactly what the UPDATE statement is for.&lt;/P&gt;
&lt;P&gt;This works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data MASTER;
input (Id  Name  Sales   Transaction   Example  Act_Ind   Valid_From  Valid_To) (:$20.);
cards;
1   Unit  True  6   58001   Y   19900101T000000   99991231T235959
2   Key   True  6   121216  Y   199100101T000000   99991231T235959
3   Value   True  18  820595,2  Y   19920101T000000   99991231T235959
run;

data TRANS;
input (Id  Name  Sales   Transaction   Example  Act_Ind   Valid_From  Valid_To) (:$20.);
cards;
2   Key   True  8   121216  Y   20200404T000000   99991231T235959
run;

data MASTER;
  modify MASTER
         TRANS(rename=(
           NAME=N SALES=S TRANSACTION=T EXAMPLE=E ACT_IND=A VALID_FROM=VF VALID_TO=VT      
         ));
  by ID;
  select (_IORC_); 
    when (%SYSRC(_SOK)) do;    %* Transaction matches master; 
      Valid_To=VF;Act_Ind='N';
      replace;  
      NAME=N; SALES=S; TRANSACTION=T; EXAMPLE=E; ACT_IND=A; VALID_FROM=VF; VALID_TO=VT;      
      output;
    end;     
    when (%SYSRC(_DSENMR)) do; %* New Transaction ;
      output;    
      _error_=0;    
    end;    
    when (%SYSRC(_DSEMTR)) do; %* New Transaction, not first key ; 
      put 'ERR' 'OR: Duplicate Values on transaction dataset';  
      stop;     
    end;    
    otherwise do;   
      put 'ERR' 'OR: Unknown IO ';  
      stop;   
    end;  
  end; 
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;TABLE class="table" style="border-collapse: collapse; border-spacing: 0px; margin-bottom: 1em; border-width: 1px 0px 0px 1px; border-style: solid; border-color: #c1c1c1; border-image: initial; margin-left: auto; margin-right: auto; color: #000000; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: center; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #fafbfe; text-decoration-style: initial; text-decoration-color: initial;" aria-label="Data Set WORK.MASTER"&gt;&lt;CAPTION aria-label="Data Set WORK.MASTER"&gt;&amp;nbsp;&lt;/CAPTION&gt;&lt;COLGROUP&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;COL style="border-left: 1px solid #c1c1c1; border-right: 0px solid #c1c1c1;" /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;Id&lt;/TH&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;Name&lt;/TH&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;Sales&lt;/TH&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;Transaction&lt;/TH&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;Example&lt;/TH&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;Act_Ind&lt;/TH&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;Valid_From&lt;/TH&gt;
&lt;TH class="header" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #edf2f9; border-color: #b0b7bb; border-style: solid; border-width: 0px 1px 1px 0px; color: #112277; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: bold;" scope="col"&gt;Valid_To&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;1&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;Unit&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;True&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;6&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;58001&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;Y&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;19900101T000000&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;99991231T235959&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;2&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;Key&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;True&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;6&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;121216&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;N&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;199100101T000000&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;20200404T000000&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;3&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;Value&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;True&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;18&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;820595,2&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;Y&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;19920101T000000&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;99991231T235959&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="border-top: 1px solid #c1c1c1; border-bottom: 0px solid #c1c1c1;"&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;2&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;Key&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;True&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;8&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;121216&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;Y&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;20200404T000000&lt;/TD&gt;
&lt;TD class="data" style="text-align: left; padding: 3px 6px; vertical-align: top; background-color: #ffffff; border-color: #c1c1c1; border-style: solid; border-width: 0px 1px 1px 0px; font-family: Arial, 'Albany AMT', Helvetica, Helv; font-size: x-small; font-style: normal; font-weight: normal;"&gt;99991231T235959&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you did not provide metadata in the form of a data step for the existing tables, so I just used what was easier.&lt;/P&gt;
&lt;P&gt;If the table is so large that sorting it is not an option, a different method that uses an index can be coded to access observations directly.&lt;/P&gt;
&lt;P&gt;A good resource: &lt;A href="https://www.lexjansen.com/pnwsug/2006/PN01CurtisMackModify.pdf" target="_blank" rel="noopener"&gt;https://www.lexjansen.com/pnwsug/2006/PN01CurtisMackModify.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 22:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637796#M189622</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-06T22:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637799#M189623</link>
      <description>&lt;P&gt;This is going nowhere.&lt;/P&gt;
&lt;P&gt;Please supply example data in data steps with datalines &lt;STRONG&gt;(THIS IS AN ABSOLUTE REQUIREMENT!),&lt;/STRONG&gt; and what you want to get out of it.&lt;/P&gt;
&lt;P&gt;Right now I have no idea any longer what your data looks like.&lt;/P&gt;
&lt;P&gt;Hint: using _all_ in a by statement makes no sense in most cases.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 07:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637799#M189623</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-06T07:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637800#M189624</link>
      <description>&lt;P&gt;Will it works if the new data is inserted or if any existing data is deleted?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 07:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637800#M189624</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-04-06T07:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637802#M189625</link>
      <description>I don't understand the question. As you can see this answers the need you expressed.Adapt the code to your exact data.&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Apr 2020 08:02:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637802#M189625</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-06T08:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637810#M189628</link>
      <description>&lt;P&gt;If my trans data is as below then the MASTER dataset is not updating as we want. I tried to tweak your code but it didn't helped either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data TRANS;
input (Id  Name  Sales   Transaction   Example  Act_Ind   Valid_From  Valid_To) (:$20.);
cards;
4   Track   False  10  121216  Y   20200404T000000   99991231T235959
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Apr 2020 08:47:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637810#M189628</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-04-06T08:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Select only updated records and load the updated records in SQL table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637814#M189631</link>
      <description>&lt;P&gt;Did you read the document I pointed to?&lt;BR /&gt;To insert new records, you need to test for &amp;nbsp; &lt;FONT face="courier new,courier"&gt;_DSENOM&lt;/FONT&gt;&amp;nbsp;&amp;nbsp; and &amp;nbsp; &lt;FONT face="courier new,courier"&gt;output &amp;nbsp;&lt;/FONT&gt; the new record. &lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 22:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-only-updated-records-and-load-the-updated-records-in-SQL/m-p/637814#M189631</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-04-06T22:05:28Z</dc:date>
    </item>
  </channel>
</rss>

