<?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: Update/Insert into SQL table from SAS in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Update-Insert-into-SQL-table-from-SAS/m-p/3953#M157</link>
    <description>Here is an example:&lt;BR /&gt;
&lt;BR /&gt;
data master(index=(ssn));&lt;BR /&gt;
input ssn : $11. nickname $5.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
161-60-5881 chk1&lt;BR /&gt;
160-58-1223 chk2&lt;BR /&gt;
;&lt;BR /&gt;
data trans;&lt;BR /&gt;
input ssn : $11. tnicknam $5.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
161-60-5881 Josh&lt;BR /&gt;
160-58-1223 Kathy&lt;BR /&gt;
134-56-9094 Meg&lt;BR /&gt;
142-67-9888 Bill&lt;BR /&gt;
;&lt;BR /&gt;
proc sort data=trans;&lt;BR /&gt;
by ssn;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data master;&lt;BR /&gt;
set trans;&lt;BR /&gt;
by ssn;&lt;BR /&gt;
modify master key=ssn;&lt;BR /&gt;
	if _iorc_=%sysrc(_sok) then do;      &lt;BR /&gt;
         nickname=tnicknam;&lt;BR /&gt;
		 _error_=0;&lt;BR /&gt;
		 put 'in replace';&lt;BR /&gt;
         replace master;&lt;BR /&gt;
      end;&lt;BR /&gt;
	else if (%sysrc(_dsenom)) then do;&lt;BR /&gt;
         _error_=0;&lt;BR /&gt;
		 nickname=tnicknam;&lt;BR /&gt;
		 put 'in insert';&lt;BR /&gt;
		 output master;&lt;BR /&gt;
      end;      &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=master;&lt;BR /&gt;
run;</description>
    <pubDate>Thu, 04 Oct 2007 13:04:56 GMT</pubDate>
    <dc:creator>Anitha_SAS</dc:creator>
    <dc:date>2007-10-04T13:04:56Z</dc:date>
    <item>
      <title>Update/Insert into SQL table from SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Update-Insert-into-SQL-table-from-SAS/m-p/3952#M156</link>
      <description>I have to write a code in SAS that updates an existing table in SQL database from SAS file  for the existing cases, and insert any new cases into the same table. Is this possible. If so how. I have SAS ver 9.1.3 and SAS/ACCESS for windows pc. &lt;BR /&gt;
&lt;BR /&gt;
thanks</description>
      <pubDate>Tue, 24 Jul 2007 14:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Update-Insert-into-SQL-table-from-SAS/m-p/3952#M156</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-07-24T14:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Update/Insert into SQL table from SAS</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Update-Insert-into-SQL-table-from-SAS/m-p/3953#M157</link>
      <description>Here is an example:&lt;BR /&gt;
&lt;BR /&gt;
data master(index=(ssn));&lt;BR /&gt;
input ssn : $11. nickname $5.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
161-60-5881 chk1&lt;BR /&gt;
160-58-1223 chk2&lt;BR /&gt;
;&lt;BR /&gt;
data trans;&lt;BR /&gt;
input ssn : $11. tnicknam $5.;&lt;BR /&gt;
datalines;&lt;BR /&gt;
161-60-5881 Josh&lt;BR /&gt;
160-58-1223 Kathy&lt;BR /&gt;
134-56-9094 Meg&lt;BR /&gt;
142-67-9888 Bill&lt;BR /&gt;
;&lt;BR /&gt;
proc sort data=trans;&lt;BR /&gt;
by ssn;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data master;&lt;BR /&gt;
set trans;&lt;BR /&gt;
by ssn;&lt;BR /&gt;
modify master key=ssn;&lt;BR /&gt;
	if _iorc_=%sysrc(_sok) then do;      &lt;BR /&gt;
         nickname=tnicknam;&lt;BR /&gt;
		 _error_=0;&lt;BR /&gt;
		 put 'in replace';&lt;BR /&gt;
         replace master;&lt;BR /&gt;
      end;&lt;BR /&gt;
	else if (%sysrc(_dsenom)) then do;&lt;BR /&gt;
         _error_=0;&lt;BR /&gt;
		 nickname=tnicknam;&lt;BR /&gt;
		 put 'in insert';&lt;BR /&gt;
		 output master;&lt;BR /&gt;
      end;      &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=master;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 04 Oct 2007 13:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Update-Insert-into-SQL-table-from-SAS/m-p/3953#M157</guid>
      <dc:creator>Anitha_SAS</dc:creator>
      <dc:date>2007-10-04T13:04:56Z</dc:date>
    </item>
  </channel>
</rss>

