<?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: Trying to insert 10k data into DB2 table from SAS EG in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948370#M42598</link>
    <description>Yes I dont want replace missing value , the reason  i want to use proc append so it just get append</description>
    <pubDate>Mon, 21 Oct 2024 12:38:57 GMT</pubDate>
    <dc:creator>animesh123</dc:creator>
    <dc:date>2024-10-21T12:38:57Z</dc:date>
    <item>
      <title>Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948341#M42594</link>
      <description>&lt;P&gt;Hi - I am trying to insert 10k data into DB2 table from SAS EG&amp;nbsp; ran&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc append showing error&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;ERROR: CLI execute error: [IBM][CLI Driver][DB2] SQL0407N Assignment of a NULL value to a NOT NULL column "*N" is not allowed. &lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;SQLSTATE=23502&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tried proc copy showing the same error&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a way we can use proc sql for this&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 10:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948341#M42594</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-10-21T10:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948342#M42595</link>
      <description>&lt;P&gt;From the error it looks like you are trying to insert missing value to a column with "no missing allowed" constraint.&lt;/P&gt;
&lt;P&gt;Are you sure there are no missing data in your "to-be-inserted" table?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 10:27:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948342#M42595</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-10-21T10:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948351#M42596</link>
      <description>&lt;P&gt;yes there is a missing value , is there a way to handle this missing value or handle this type of error .&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 11:34:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948351#M42596</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-10-21T11:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948355#M42597</link>
      <description>&lt;P&gt;Options that came to my head "right away":&lt;/P&gt;
&lt;P&gt;1) if you have DB2 admin rights for the table (and it's not a business critical one but a temporary) then do "alter table" [but I'm wiling to bet $5 that this is not the case]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) remove observations with missing values from the transaction table (e.g. the WHERE= dataset option, `WHERE=(&amp;lt;variableName&amp;gt; is not null)`)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) replace missing values with proper values that suppose to be there&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 11:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948355#M42597</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-10-21T11:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948370#M42598</link>
      <description>Yes I dont want replace missing value , the reason  i want to use proc append so it just get append</description>
      <pubDate>Mon, 21 Oct 2024 12:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948370#M42598</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-10-21T12:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948389#M42600</link>
      <description>&lt;P&gt;It won't "&lt;SPAN&gt;just get append&lt;/SPAN&gt;" because your input data violates database restrictions...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 14:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948389#M42600</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-10-21T14:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948524#M42606</link>
      <description>&lt;P&gt;So since I have fix this missing value issue with below code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if cmiss(char_vars[i]) then char_vars[i]=' ';&lt;BR /&gt;if nmiss(num_vars[j]) then num_vars[j]='1';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now as I tried to do the proc append am getting different error&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: CLI execute error: [IBM][CLI Driver][DB2] SQL0803N One or more values in the INSERT statement, UPDATE statement, or foreign &lt;BR /&gt;key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified &lt;BR /&gt;by "YGRT1KL1" constrains table "0000004201" from having duplicate values for the index key. SQLSTATE=23505.&lt;/P&gt;
&lt;P&gt;Is there are any fix other than this ?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 09:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948524#M42606</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-10-22T09:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948538#M42609</link>
      <description>&lt;P&gt;Yes, remove observations that violates "uniqueness" of&amp;nbsp; primary key, exactly as the error note says:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"because the primary key, unique constraint or unique index identified&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;by "&lt;STRONG&gt;YGRT1KL1"&lt;/STRONG&gt; constrains table "&lt;STRONG&gt;0000004201&lt;/STRONG&gt;" from &lt;STRONG&gt;having duplicate values for the index key&lt;/STRONG&gt;"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data you prepared have duplicates over data already in the table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure you want to "append" that data? Maybe you need to do an "update"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 10:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948538#M42609</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-10-22T10:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948540#M42610</link>
      <description>I have like 70 variable and near about 1.3M Obs , &lt;BR /&gt;using update statement I have to define all the variable .correct ?</description>
      <pubDate>Tue, 22 Oct 2024 11:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948540#M42610</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-10-22T11:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948542#M42611</link>
      <description>&lt;P&gt;SAS doesn't have a concept of NULL values. In SAS a character missing results in a blank on the DB side so I believe you only need to change missing numerical values to some value.&lt;/P&gt;
&lt;P&gt;The issue with the primary/unique key violation means that either your source data doesn't comply with the target table definition - like if you've got multiple rows in your source data with the same key value - or that you need to load via update/insert.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DB2 got a MERGE statement that allows for update/insert via a single SQL. This of course requires you to write explicit pass-through SQL. A common way is to load your source data in SAS first into a staging table (can be a temporary DB2 table) and then run the upsert on the DB2 via explicit pass-through SQL.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I just copy/pasted the following prompts into Copilot and the answer with sample code looks pretty much o.k. to me.&lt;/P&gt;
&lt;PRE&gt;sample code SAS table temporary DB2 staging table upsert DB2 target table&lt;/PRE&gt;
&lt;P&gt;And yes, you need to type all the variables but you can of course generate this list and then just amend it in a text editor. I myself use often Notepad++ with RegEx search &amp;amp; replace for such tasks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One quick way to just create the list of variables in the SAS log - in below sample for sashelp.class:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options ls=max ps=max;
proc sql feedback noexec;
  select * 
  from sashelp.class c
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 11:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948542#M42611</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-10-22T11:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948715#M42622</link>
      <description>&lt;P&gt;Hey Guys ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So after fixing the duplicate and missing value the append code were working fine for 10bs ,&lt;/P&gt;
&lt;P&gt;But now since I tried to process the total (83.7 mil) data&amp;nbsp; , its throwing error&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: CLI execute error: [IBM][CLI Driver] CLI0111E Numeric value out of range. SQLSTATE=22003&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 11:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948715#M42622</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-10-23T11:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to insert 10k data into DB2 table from SAS EG</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948796#M42623</link>
      <description>&lt;P&gt;Get the documentation of the target table, and then check your SAS dataset against it. Pay particular attention to numeric columns defined as integer and/or with less than 8 bytes. Run PROC MEANS on these columns and get the MIN and MAX statistics.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 17:49:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Trying-to-insert-10k-data-into-DB2-table-from-SAS-EG/m-p/948796#M42623</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-23T17:49:27Z</dc:date>
    </item>
  </channel>
</rss>

