<?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: Using NULLCHAR with Teradata? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18075#M2671</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm...I'm not sure what you mean by looking at the Teradata table. My libname statement looks like this if that's what you mean: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;libname td teradata user="&amp;amp;username." password="&amp;amp;password." database="&amp;amp;db." server="&amp;amp;servername" logdb=spool_reserve;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What my script is doing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Create a SAS data set using passthrough SQL to Teradata&lt;/P&gt;&lt;P&gt;2. Delete all data from the Teradata target table&lt;/P&gt;&lt;P&gt;3. Insert the data set to the Teradata target using the SAS in my first post&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping the NULLCHAR option would convert the missing values to NULLs on the 3rd step - I should say I'm open to other ways of accomplishing this. (Doesn't have to be NULLCHAR!) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More code below - does that help? Thanks again for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; connect to teradata (user="&amp;amp;username" password="&amp;amp;password" database="&amp;amp;db" server="&amp;amp;servername" mode=teradata);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; CREATE table mydataset as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; select * from connection to teradata&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT yada yada yada from various tables&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;disconnect from teradata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; connect to teradata (user="&amp;amp;username" password="&amp;amp;password" database="&amp;amp;db" server="&amp;amp;servername" mode=teradata);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; execute(delete from "&amp;amp;database.".mytable) by teradata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;quit;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;proc append base=td.mytable (nullchar=yes fastload=yes TPT=yes TPT_MAX_SESSIONS=8 TENACITY=6 SLEEP=1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; DATA=mydataset force;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Dec 2011 05:00:06 GMT</pubDate>
    <dc:creator>TimS</dc:creator>
    <dc:date>2011-12-21T05:00:06Z</dc:date>
    <item>
      <title>Using NULLCHAR with Teradata?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18073#M2669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm pretty (very) new to SAS, so this may be something simple that I'm missing...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've built a data set that I now want to insert into a Teradata table. I also want to insert NULLs for any missing values. So, I found the NULLCHAR option (&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001371592.htm"&gt;http://support.sas.com/documentation/cdl/en/acreldb/63647/HTML/default/viewer.htm#a001371592.htm) so&lt;/A&gt;unds like exactly what I want: if I set it to "YES" it "indicates that missing character values in SAS data sets are treated as NULL values if the DBMS allows NULLs. Otherwise, an error is returned."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to figure out if I'm using it incorrectly...because my table in Teradata is still showing blanks instead of NULLs. The code below is not giving me any errors/warnings, and since I'm not really sure what I'm doing, I've tried it in other places in my code, and they all gave me syntax errors. So while it's not giving me any errors, it's not really having any effect. (I'm on Teradata v13.10.02.08 and SAS 9.2, btw).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my code...am I using this incorrectly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc append base=td.mytable (&lt;STRONG&gt;nullchar=yes&lt;/STRONG&gt; fastload=yes TPT=yes TPT_MAX_SESSIONS=8 TENACITY=6 SLEEP=1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA=mydataset force;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if I need to provide more info. And thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 00:40:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18073#M2669</guid>
      <dc:creator>TimS</dc:creator>
      <dc:date>2011-12-21T00:40:41Z</dc:date>
    </item>
    <item>
      <title>Using NULLCHAR with Teradata?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18074#M2670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How are you looking at the Teradata table?&amp;nbsp; If you are looking at it from the SAS side then it has already been converted back to blanks on the way back out of the database.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 00:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18074#M2670</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-12-21T00:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using NULLCHAR with Teradata?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18075#M2671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm...I'm not sure what you mean by looking at the Teradata table. My libname statement looks like this if that's what you mean: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;libname td teradata user="&amp;amp;username." password="&amp;amp;password." database="&amp;amp;db." server="&amp;amp;servername" logdb=spool_reserve;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What my script is doing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Create a SAS data set using passthrough SQL to Teradata&lt;/P&gt;&lt;P&gt;2. Delete all data from the Teradata target table&lt;/P&gt;&lt;P&gt;3. Insert the data set to the Teradata target using the SAS in my first post&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping the NULLCHAR option would convert the missing values to NULLs on the 3rd step - I should say I'm open to other ways of accomplishing this. (Doesn't have to be NULLCHAR!) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More code below - does that help? Thanks again for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; connect to teradata (user="&amp;amp;username" password="&amp;amp;password" database="&amp;amp;db" server="&amp;amp;servername" mode=teradata);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; CREATE table mydataset as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; select * from connection to teradata&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT yada yada yada from various tables&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;disconnect from teradata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; connect to teradata (user="&amp;amp;username" password="&amp;amp;password" database="&amp;amp;db" server="&amp;amp;servername" mode=teradata);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; execute(delete from "&amp;amp;database.".mytable) by teradata;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;quit;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;proc append base=td.mytable (nullchar=yes fastload=yes TPT=yes TPT_MAX_SESSIONS=8 TENACITY=6 SLEEP=1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp; DATA=mydataset force;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 05:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18075#M2671</guid>
      <dc:creator>TimS</dc:creator>
      <dc:date>2011-12-21T05:00:06Z</dc:date>
    </item>
    <item>
      <title>Using NULLCHAR with Teradata?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18076#M2672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After check the documentatin about Teradata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To control how SAS missing character values are handled by Teradata, use&lt;/P&gt;&lt;P&gt;the NULLCHAR= and NULLCHARVAL= data set options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By default, Teradata columns accept NULL values. However, you can define columns&lt;/P&gt;&lt;P&gt;so that they do not contain NULL values. For example, when you create a SALES&lt;/P&gt;&lt;P&gt;table, define the CUSTOMER column as NOT NULL, telling Teradata not to add a row&lt;/P&gt;&lt;P&gt;to the table unless the CUSTOMER column for the row has a value. When creating a&lt;/P&gt;&lt;P&gt;Teradata table with SAS/ACCESS, you can use the DBNULL= data set option to&lt;/P&gt;&lt;P&gt;indicate whether NULL is a valid value for specified columns.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 07:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18076#M2672</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-12-21T07:51:37Z</dc:date>
    </item>
    <item>
      <title>Using NULLCHAR with Teradata?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18077#M2673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;Ksharp wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After check the documentatin about Teradata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To control how SAS missing character values are handled by Teradata, use&lt;/P&gt;&lt;P&gt;the NULLCHAR= and NULLCHARVAL= data set options.&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, those are the options I'm trying to use - but I can't get them working, unless I'm using NULLCHAR incorrectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 16:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18077#M2673</guid>
      <dc:creator>TimS</dc:creator>
      <dc:date>2011-12-21T16:05:19Z</dc:date>
    </item>
    <item>
      <title>Using NULLCHAR with Teradata?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18078#M2674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are you actually trying to do?&amp;nbsp; Do you have an application where this is an issue or are you just exploring how to work with Teradata?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Teradata you can have a character variable that is NULL and that value is a different value than all blank characters.&lt;/P&gt;&lt;P&gt;In SAS there is no way to make that distinction.&lt;/P&gt;&lt;P&gt;If you are just working with the data from the SAS side using a libref then even if you succeed in getting Teradata to store NULL it wouldn't make any difference to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To really test what is happening you will need to use pass-through SQL .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2011 18:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18078#M2674</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-12-21T18:08:21Z</dc:date>
    </item>
    <item>
      <title>Using NULLCHAR with Teradata?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18079#M2675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You know what...today we completed an upgrade in our SAS environment (specifically, how we connect to Teradata) and this option magically started working. So I think the syntax I was using was correct, and it was some configuration issue then. Thanks to all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2011 20:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-NULLCHAR-with-Teradata/m-p/18079#M2675</guid>
      <dc:creator>TimS</dc:creator>
      <dc:date>2011-12-22T20:01:23Z</dc:date>
    </item>
  </channel>
</rss>

