<?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: Loading SAS dataset to SQL Server with Date Fields in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776806#M247090</link>
    <description>&lt;P&gt;It is a standard Microsoft SQL Server database.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Oct 2021 16:50:19 GMT</pubDate>
    <dc:creator>PhatRam33</dc:creator>
    <dc:date>2021-10-27T16:50:19Z</dc:date>
    <item>
      <title>Loading SAS dataset to SQL Server with Date Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776766#M247084</link>
      <description>&lt;P&gt;I'm having an odd issue.&amp;nbsp; I'm creating a new table in SQL server from SAS for one of my data sets.&amp;nbsp; The date fields are saved in date9 format from original source.&amp;nbsp; When this data gets uploaded to SQL, it is storing as a text field in YYYY-MM-DD for some reason and can't figure out why.&amp;nbsp; Any suggestion or workarounds for this issue?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 15:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776766#M247084</guid>
      <dc:creator>PhatRam33</dc:creator>
      <dc:date>2021-10-27T15:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS dataset to SQL Server with Date Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776795#M247089</link>
      <description>What type of DB? Usually they require dates to be uploaded as a datetime not a SAS date.</description>
      <pubDate>Wed, 27 Oct 2021 16:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776795#M247089</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-27T16:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS dataset to SQL Server with Date Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776806#M247090</link>
      <description>&lt;P&gt;It is a standard Microsoft SQL Server database.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 16:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776806#M247090</guid>
      <dc:creator>PhatRam33</dc:creator>
      <dc:date>2021-10-27T16:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS dataset to SQL Server with Date Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776809#M247091</link>
      <description>Try using a YYYY-MM-DD format on the SAS side which SQL would recognize as a date literal or the datetime format would be my suggestions then. &lt;BR /&gt;</description>
      <pubDate>Wed, 27 Oct 2021 16:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776809#M247091</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-27T16:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS dataset to SQL Server with Date Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776869#M247096</link>
      <description>&lt;P&gt;What SAS SQL Server database engine are you using? SQLSVR or ODBC? What version of MS SQL Server ODBC driver are you using? Older ODBC drivers sometimes have problems handling dates correctly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 20:50:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776869#M247096</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-10-27T20:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Loading SAS dataset to SQL Server with Date Fields</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776876#M247098</link>
      <description>&lt;P&gt;If you're really sure that on the SAS side the variable is numerical and contains a SAS Date value then this is really an odd one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With SAS not having a Date type the only way to detect date variables is via the format applied to the variable. I've experienced in the past that this didn't work properly with all SAS Date formats but it did always work when using formats DATE9 or DATETIME20. (...just the ones SAS creates when loading a DATE type from a DB into SAS).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May be run a proc contents against your source table to ensure the variable is of the correct type with the necessary format attached.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also use&amp;nbsp;&lt;EM&gt;OPTIONS SASTRACE=',,,d' SASTRACELOC=SASLOG NOSTSUFFIX;&lt;/EM&gt; on top of the code to get a bit more information what's actually happening.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you describe sounds like the process would have to identify the SAS column as containing a date but then create magically some numeric to text conversion logic (put on the SAS side or cast on the DB side). That would be really odd. Hopefully running your code with above options will tell us a bit more.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Oct 2021 22:11:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loading-SAS-dataset-to-SQL-Server-with-Date-Fields/m-p/776876#M247098</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-27T22:11:19Z</dc:date>
    </item>
  </channel>
</rss>

