<?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 KEY = Option in MODIFY Statement to update DBMS Table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/KEY-Option-in-MODIFY-Statement-to-update-DBMS-Table/m-p/147127#M297447</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to update the DBMS Table by using following LIBNAME statement...based on my knowledge if we want to user KEY= option on DBMS Table then&amp;nbsp; reread_exposure=yes must be set...In below example, Index is already created on PK variable, so i can directly use it in KEY= option...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my_data.test contains one record and i need to update the table based on following data...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i am getting following error...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: No key variables have been defined for file test.&lt;/P&gt;&lt;P&gt;ERROR: ROLLBACK issued due to errors for data set TEST.test.DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIBNAME my_data MYSQL&amp;nbsp; SERVER="xxxxx"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATABASE=my_database&amp;nbsp; MYSQL_PORT=3306&amp;nbsp; USER=xxxx &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PASSWORD="xxxxxxxxx" reread_exposure=yes;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data my_data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input pk var;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;0 6&lt;/P&gt;&lt;P&gt;1 7&lt;/P&gt;&lt;P&gt;2 8&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;data my_data.test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set my_data(rename=(var = new_var));&lt;/P&gt;&lt;P&gt;&amp;nbsp; modify my_data.test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = pk; /* In our case, Index is already created for SK, so we can use it */&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _IORC_ = %sysrc(_sok) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var = new_var;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if _IORC_ = %sysrc(_dsenom) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var = new_var;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _ERROR_ = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me why i am getting this error eventhough i set the proper options...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Urvish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Aug 2014 08:54:28 GMT</pubDate>
    <dc:creator>UrvishShah</dc:creator>
    <dc:date>2014-08-04T08:54:28Z</dc:date>
    <item>
      <title>KEY = Option in MODIFY Statement to update DBMS Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/KEY-Option-in-MODIFY-Statement-to-update-DBMS-Table/m-p/147127#M297447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to update the DBMS Table by using following LIBNAME statement...based on my knowledge if we want to user KEY= option on DBMS Table then&amp;nbsp; reread_exposure=yes must be set...In below example, Index is already created on PK variable, so i can directly use it in KEY= option...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my_data.test contains one record and i need to update the table based on following data...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i am getting following error...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: No key variables have been defined for file test.&lt;/P&gt;&lt;P&gt;ERROR: ROLLBACK issued due to errors for data set TEST.test.DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIBNAME my_data MYSQL&amp;nbsp; SERVER="xxxxx"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATABASE=my_database&amp;nbsp; MYSQL_PORT=3306&amp;nbsp; USER=xxxx &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PASSWORD="xxxxxxxxx" reread_exposure=yes;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data my_data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input pk var;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;0 6&lt;/P&gt;&lt;P&gt;1 7&lt;/P&gt;&lt;P&gt;2 8&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;data my_data.test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set my_data(rename=(var = new_var));&lt;/P&gt;&lt;P&gt;&amp;nbsp; modify my_data.test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = pk; /* In our case, Index is already created for SK, so we can use it */&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _IORC_ = %sysrc(_sok) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var = new_var;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if _IORC_ = %sysrc(_dsenom) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var = new_var;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _ERROR_ = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me why i am getting this error eventhough i set the proper options...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Urvish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2014 08:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/KEY-Option-in-MODIFY-Statement-to-update-DBMS-Table/m-p/147127#M297447</guid>
      <dc:creator>UrvishShah</dc:creator>
      <dc:date>2014-08-04T08:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: KEY = Option in MODIFY Statement to update DBMS Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/KEY-Option-in-MODIFY-Statement-to-update-DBMS-Table/m-p/147128#M297448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The modify is not often used. The message is coming from your DBMS system.&lt;/P&gt;&lt;P&gt;It says there have no indexes&amp;nbsp; been defined within the DBMS on your table so key= is failing.&lt;/P&gt;&lt;P&gt;the sastrace option (and more like that) should help in debugging. &lt;A href="http://www2.sas.com/proceedings/sugi31/264-31.pdf" title="http://www2.sas.com/proceedings/sugi31/264-31.pdf"&gt;http://www2.sas.com/proceedings/sugi31/264-31.pdf&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2014 12:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/KEY-Option-in-MODIFY-Statement-to-update-DBMS-Table/m-p/147128#M297448</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-08-04T12:55:44Z</dc:date>
    </item>
  </channel>
</rss>

