<?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: Date to text in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874582#M345559</link>
    <description>By sas/access do u mean i need sas/access interface to odbc license?</description>
    <pubDate>Mon, 08 May 2023 23:15:11 GMT</pubDate>
    <dc:creator>HeatherNewton</dc:creator>
    <dc:date>2023-05-08T23:15:11Z</dc:date>
    <item>
      <title>Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874328#M345431</link>
      <description>If i have data in sas date9. Format eg 30nov2022, i want to change it text as 2022-11-30 so i can load to DB2 how do i do it?&lt;BR /&gt;Same for timestamp eg 30nov2022:11:30:22, how to convert to text as 2022-11-30.11.30.22 to load in DB2</description>
      <pubDate>Sun, 07 May 2023 12:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874328#M345431</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-05-07T12:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874329#M345432</link>
      <description>&lt;P&gt;SAS/ACCESS for DB/2 will send the data correctly to the database, regardless of display format.&lt;/P&gt;
&lt;P&gt;If you communicate with the DB via textfiles, use the YYMMDD10. format in the PUT statement.&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 18:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874329#M345432</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-07T18:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874335#M345436</link>
      <description>So you mean i can direct transfer sas dataset to db2. What is requirement on schema setting on db2?</description>
      <pubDate>Sun, 07 May 2023 15:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874335#M345436</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-05-07T15:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874350#M345445</link>
      <description>&lt;P&gt;The schema is set with the SCHEMA= option of the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acreldb/p1em9x5l0q0h8vn1rfhudacb42hu.htm" target="_blank" rel="noopener"&gt;LIBNAME DB2&lt;/A&gt; statement.&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 18:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874350#M345445</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-07T18:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874351#M345446</link>
      <description>&lt;P&gt;You can directly update or append DB2 tables from&amp;nbsp;SAS datasets using SAS/ACCESS to DB2. SAS dates will correctly update DB2 dates. Based on the SAS variable types and formats used, SAS will translate these into valid new (if creating a DB2 table) or valid existing DB2 column definitions (if the DB2 table already exists).&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 20:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874351#M345446</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-05-07T20:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874582#M345559</link>
      <description>By sas/access do u mean i need sas/access interface to odbc license?</description>
      <pubDate>Mon, 08 May 2023 23:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874582#M345559</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-05-08T23:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874586#M345563</link>
      <description>&lt;P&gt;Yes, if that is the SAS product you are accessing DB2 with.&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 23:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874586#M345563</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-05-08T23:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874595#M345572</link>
      <description>&lt;P&gt;Wait, wait, wait.&lt;/P&gt;
&lt;P&gt;In your initial post, you asked&amp;nbsp;&lt;EM&gt;how to transfer dates to DB/2&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;Now you say you&amp;nbsp;&lt;EM&gt;do not even have a connection to DB/2 yet&lt;/EM&gt;?&lt;/P&gt;
&lt;P&gt;Please start at the root of your issue when posting questions. &lt;U&gt;Describe your current situation in detail, and what you want to achieve&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;E.g. show us the log from PROC SETINIT, so we can see your licensed SAS products.&lt;/P&gt;
&lt;P&gt;Setting up a direct connection to the DB requires the support of your DB/2 admins (they need to install the DB client on the SAS server, and the ODBC driver if you only have ACCESS to ODBC licensed).&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 04:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/874595#M345572</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-09T04:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875558#M345948</link>
      <description>&lt;P&gt;I try a few methods to convert batch_date in date9. to yymmdd10. and cannot make it work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried&amp;nbsp;&lt;/P&gt;
&lt;P&gt;informat batch_date yymmdd10.&amp;nbsp; nothing happened&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;P&gt;put ( batch_date, yymmdd10.)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;put batch_date yymmdd10.&lt;/P&gt;
&lt;P&gt;also no work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I missing in each case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 04:33:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875558#M345948</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-05-13T04:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875560#M345950</link>
      <description>&lt;P&gt;Please read my post again, in particular the underlined part, and provide all the information requested.&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 04:45:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875560#M345950</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-13T04:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875562#M345952</link>
      <description>&lt;P&gt;I have sas dataset where batch_date looks like 30NOV2022&lt;/P&gt;
&lt;P&gt;now I need to convert the sas data set to csv and load into DB2&lt;/P&gt;
&lt;P&gt;and in DB2 I want batch_date to look like 2022-11-30 instead&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my questions is before I convert sas data set to csv, how do I convert format of batch_date from date9. to yyyymmdd10.??&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 05:14:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875562#M345952</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-05-13T05:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875566#M345956</link>
      <description>&lt;P&gt;In DB/2, dates are displayed in YYYY-MM-DD (ISO standard) per default.&lt;/P&gt;
&lt;P&gt;To create a csv file with the correct format, do this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* test data */
data have;
input
  batch_date :date9.
  xxx $
;
format batch_date date9.;
datalines;
30nov2022 text
;

data _null_;
set have;
file "path_to_location/want.csv" dlm=",";
format
  batch_date yymmdd10.
;
if _n_ = 1 then put("batch_date,xxx"); * only if header line is needed;
put
  batch_date
  xxx
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The additional column xxx is used as an example for further columns you want to export&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 17:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875566#M345956</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-05-13T17:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Date to text</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875595#M345971</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I try a few methods to convert batch_date in date9. to yymmdd10. and cannot make it work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried&amp;nbsp;&lt;/P&gt;
&lt;P&gt;informat batch_date yymmdd10.&amp;nbsp; nothing happened&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;P&gt;put ( batch_date, yymmdd10.)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;put batch_date yymmdd10.&lt;/P&gt;
&lt;P&gt;also no work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I missing in each case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;INFORMATs are used to convert text into values.&amp;nbsp; Since you already have values in your dataset changing the INFORMAT associated with the variable will not have ANY impact at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FORMATs are used to convert values into text.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you want your date values to print in the style YYYY-MM-DD then attach the YYMMDD10. &lt;STRONG&gt;FORMAT&lt;/STRONG&gt; to the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Double check the current format attached to your variable.&amp;nbsp; If it is DATE9 then changing the format to YYMMDD10. will make the dates print the way you want.&amp;nbsp; I have NO IDEA whether or not that will help with DB2.&amp;nbsp; You would need to ask your DB2 database administrator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if the current format attached to your variable is DTDATE9. then you have DATETIME values and not DATE values in the variable.&amp;nbsp; In that case using YYMMDD10. format to display them will not work.&amp;nbsp; You could use&amp;nbsp;E8601DN10. format instead to print the datepart of a datetime value in the style YYYY-MM-DD.&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 14:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-to-text/m-p/875595#M345971</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-05-13T14:16:12Z</dc:date>
    </item>
  </channel>
</rss>

