<?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: Reading a date variable from Oracle table into sas dataset creating wrong values. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-date-variable-from-Oracle-table-into-sas-dataset/m-p/863892#M341193</link>
    <description>&lt;P&gt;YEARCUTOFF has no effect on Oracle date queries. ALWAYS use 4-digit years in queries to avoid any confusion:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date = '14-FEB-2023';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If those dates in SAS are wrong, what are they in Oracle for the same posted example?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post the output from this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data = szrsmaj;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Mar 2023 19:56:54 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2023-03-13T19:56:54Z</dc:date>
    <item>
      <title>Reading a date variable from Oracle table into sas dataset creating wrong values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-date-variable-from-Oracle-table-into-sas-dataset/m-p/863890#M341191</link>
      <description>&lt;P&gt;Hello Everyone,&lt;BR /&gt;&lt;BR /&gt;I am reading a table from Oracle database into a SAS dataset which contains date variable. The value in the database table is '30-DEC-12' and when I checked in the sas dataset for a student the value is showing as '30DEC4712:00:00:00'. I dont understand why it is converting the year to 4712 and i tried yearcutoff option also which didnt make any changes, could someone help me if you know how resolve this issue&lt;BR /&gt;&lt;BR /&gt;Below is the code i am using&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;options yearcutoff=1950;&lt;/P&gt;&lt;P&gt;%let date = '14-FEB-23'; /* &amp;gt;&amp;gt;&amp;gt; !!! Capture Date!!!*/&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;proc sql NOERRORSTOP EXEC;&lt;BR /&gt;connect to odbc (user=&amp;amp;userid password= &amp;amp;password1 dsn=robanner);&lt;BR /&gt;create table szrsmaj as select *&lt;BR /&gt;from connection to odbc&lt;BR /&gt;(select szrsmaj_pidm,&lt;BR /&gt;szrsmaj_levl_code,&lt;BR /&gt;szrsmaj_degc_code,&lt;BR /&gt;szrsmaj_coll_code,&lt;BR /&gt;szrsmaj_majr_code,&lt;BR /&gt;stvmajr_desc,&lt;BR /&gt;szrsmaj_dept_coac,&lt;BR /&gt;szrsmaj_from_date,&lt;BR /&gt;szrsmaj_to_date,&lt;BR /&gt;szrsmaj_activity_date&lt;BR /&gt;from stvmajr,&lt;BR /&gt;szrsmaj&lt;BR /&gt;where szrsmaj_majr_code = stvmajr_code(+)&lt;BR /&gt;and szrsmaj_from_date &amp;lt;= &amp;amp;date.&lt;BR /&gt;and szrsmaj_to_date &amp;gt;= &amp;amp;date.&lt;BR /&gt;order by szrsmaj_pidm,&lt;BR /&gt;szrsmaj_from_date desc);&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;proc print data = szrsmaj;&lt;BR /&gt;title 'sql extract as of 14 feb 23';&lt;BR /&gt;where szrsmaj_pidm = 10037427;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Obs SZRSMAJ_PIDM SZRSMAJ_MAJR_CODE SZRSMAJ_FROM_DATE SZRSMAJ_TO_DATE6202 &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;10037427&lt;/TD&gt;&lt;TD&gt;CPE&lt;/TD&gt;&lt;TD&gt;21NOV2003:16:42:06&lt;/TD&gt;&lt;TD&gt;30DEC4712:16:42:02&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 13 Mar 2023 19:20:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-date-variable-from-Oracle-table-into-sas-dataset/m-p/863890#M341191</guid>
      <dc:creator>bhaskarkothavt</dc:creator>
      <dc:date>2023-03-13T19:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a date variable from Oracle table into sas dataset creating wrong values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-a-date-variable-from-Oracle-table-into-sas-dataset/m-p/863892#M341193</link>
      <description>&lt;P&gt;YEARCUTOFF has no effect on Oracle date queries. ALWAYS use 4-digit years in queries to avoid any confusion:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date = '14-FEB-2023';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If those dates in SAS are wrong, what are they in Oracle for the same posted example?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post the output from this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data = szrsmaj;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 19:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-a-date-variable-from-Oracle-table-into-sas-dataset/m-p/863892#M341193</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-03-13T19:56:54Z</dc:date>
    </item>
  </channel>
</rss>

