<?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: DB2 Date9 format To SAS Serial Date.... in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32438#M7808</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some more information about the query would help in replying&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Jul 2011 11:26:55 GMT</pubDate>
    <dc:creator>manojinpec</dc:creator>
    <dc:date>2011-07-18T11:26:55Z</dc:date>
    <item>
      <title>DB2 Date9 format To SAS Serial Date....</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32436#M7806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Posting for a friend who is working with DB2 for the first time and has a DB2 Date in the format of Date9.&lt;/P&gt;&lt;P&gt;Neither one of us has any idea what this date looks like.&lt;/P&gt;&lt;P&gt;She wants the date to be formatted like this: 20110906&amp;nbsp; (yyyymmdd)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: MS Shell Dlg 2;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: MS Shell Dlg 2;"&gt;Anyone know the correct way to take this DB2 Date9 filed and create a SAS Serial date then we can format it to 20110906.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: MS Shell Dlg 2;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: MS Shell Dlg 2;"&gt;TIA, Jay &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 21:36:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32436#M7806</guid>
      <dc:creator>JaySwan</dc:creator>
      <dc:date>2011-07-15T21:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Date9 format To SAS Serial Date....</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32437#M7807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the variable already pulled into a SAS dataset using SAS/Access?&amp;nbsp; I have not worked with DB2 and did not find any Date9 format for DB2 using google.&amp;nbsp; So I assume that you already have a SAS variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do a PROC CONTENTS on your dataset and see if the variable has been created as numeric or character.&lt;/P&gt;&lt;P&gt;If it is numeric then you probably just want to change the format attached to the variable using a FORMAT statement.&lt;/P&gt;&lt;P&gt;YYMMDDn8. is the SAS format for YYYYMMDD . &lt;/P&gt;&lt;P&gt;Try :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; FORMAT mydatevar YYMMDDn8. ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to create a new character variable then use the PUT function.&lt;/P&gt;&lt;P&gt;&amp;nbsp; newvar = PUT(mydatevar, YYMMDDn8.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you actually have a character variable that is in SAS date9 format then you can use the INPUT function to convert it to a DATE value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; newdatevar = INPUT(mycharvar, DATE9.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; format newdatevar YYMMDDn8.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you might need to combine the two.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; newvar = PUT( INPUT( mycharvar, DATE9.) , YYMMDDn8.);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jul 2011 22:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32437#M7807</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-07-15T22:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: DB2 Date9 format To SAS Serial Date....</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32438#M7808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some more information about the query would help in replying&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jul 2011 11:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32438#M7808</guid>
      <dc:creator>manojinpec</dc:creator>
      <dc:date>2011-07-18T11:26:55Z</dc:date>
    </item>
    <item>
      <title>DB2 Date9 format To SAS Serial Date....</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32439#M7809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your question you mention that you have no idea what the date "looks like" in DB2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usually a data base is going to store the date as a datetime.&amp;nbsp; So you will want to get just the datepart of the datetime when you read it out of db2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mySASdate = datepart(db2Date);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That will give you a SAS date that you can format any way you like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps. -s &lt;A href="http://www.sasCoders.com"&gt;www.sasCoders.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2011 18:14:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32439#M7809</guid>
      <dc:creator>sasCoders_com</dc:creator>
      <dc:date>2011-07-22T18:14:24Z</dc:date>
    </item>
    <item>
      <title>DB2 Date9 format To SAS Serial Date....</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32440#M7810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The info provided in the following post may be helpful: &lt;A href="http://www.mathkb.com/Uwe/Forum.aspx/sas/26961/DB2-DATES-in-SAS"&gt;http://www.mathkb.com/Uwe/Forum.aspx/sas/26961/DB2-DATES-in-SAS&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Jul 2011 15:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32440#M7810</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-07-23T15:26:50Z</dc:date>
    </item>
    <item>
      <title>DB2 Date9 format To SAS Serial Date....</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32441#M7811</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;We do this all the time (on z/OS mainframe)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, set the date as in: (the date passed to DB2 needs the double quotes): &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALL SYMPUT('INT_DATE',"'"||PUT(sas_date,YYMMDDD10.)||"'");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use in the SQL as in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL ;&lt;/P&gt;&lt;P&gt;CREATE TABLE DB2Table AS&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM CONNECTION TO DB2&lt;/P&gt;&lt;P&gt;(SELECT Var1,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2,&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...etc...&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp; Table&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;WHERE&amp;nbsp;&amp;nbsp; Table_Date &amp;gt;= &amp;amp;INT_DATE &lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jul 2011 14:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DB2-Date9-format-To-SAS-Serial-Date/m-p/32441#M7811</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2011-07-25T14:47:28Z</dc:date>
    </item>
  </channel>
</rss>

