<?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: appending data sets with different date formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/appending-data-sets-with-different-date-formats-solved/m-p/52366#M11075</link>
    <description>Your objective here should be to have SAS DATETIME variables (not DATE variables for clarification), as explained in your post.  Consider that SAS stores DATETIME type variables as numeric representing seconds since 01JAN1960:00:00:00.  A SAS DATE variable, a SAS numeric variable as well, represents days since 01JAN1960.&lt;BR /&gt;
&lt;BR /&gt;
So, you should not want to do a PUT at all, with your conversion code, only the INPUT to convert the character string to a SAS DATETIME numeric variable value.  Instead, perform your INPUT function, and also assign a SAS DATETIME FORMAT statement to the variable you are converting from character-format to numeric.&lt;BR /&gt;
&lt;BR /&gt;
Have a look at the SAS DOCUMENTATION on the SAS support website, where the topic about SAS DATE and DATETIME variables is discussed extensively -- URL link is  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; for reference.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks,Inc.</description>
    <pubDate>Tue, 07 Oct 2008 16:03:56 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2008-10-07T16:03:56Z</dc:date>
    <item>
      <title>appending data sets with different date formats - solved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/appending-data-sets-with-different-date-formats-solved/m-p/52365#M11074</link>
      <description>My ultimate goal is to append 2 data sets.  The base data set has 2 dates that have the format datetime22.3  These dates look like 01OCT2007:00:00:00:000&lt;BR /&gt;
The data set to be appended has the same date fields but they are formatted as $24.  They look like this:  2007/11/01:12:00:00 AM&lt;BR /&gt;
&lt;BR /&gt;
All column names in both tables are the same, but some differ in length and type.  When I use proc append with force, the dates that come from the second data set are missing after the append.  &lt;BR /&gt;
&lt;BR /&gt;
I have tried this:&lt;BR /&gt;
Admission_date = put(input(txtAdmission_date,AnyDtDTm11.), datetime22.3);&lt;BR /&gt;
This gives me 01NOV2007:00:00:00:000, but the format is still $22 rather than datetime22.3&lt;BR /&gt;
&lt;BR /&gt;
The original table was pulled from a SQL server data base using proc sql.  The second table was imported from a .csv file into a dataset.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any help.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: pk&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: pk

Message was edited by: pk</description>
      <pubDate>Tue, 07 Oct 2008 14:46:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/appending-data-sets-with-different-date-formats-solved/m-p/52365#M11074</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-07T14:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: appending data sets with different date formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/appending-data-sets-with-different-date-formats-solved/m-p/52366#M11075</link>
      <description>Your objective here should be to have SAS DATETIME variables (not DATE variables for clarification), as explained in your post.  Consider that SAS stores DATETIME type variables as numeric representing seconds since 01JAN1960:00:00:00.  A SAS DATE variable, a SAS numeric variable as well, represents days since 01JAN1960.&lt;BR /&gt;
&lt;BR /&gt;
So, you should not want to do a PUT at all, with your conversion code, only the INPUT to convert the character string to a SAS DATETIME numeric variable value.  Instead, perform your INPUT function, and also assign a SAS DATETIME FORMAT statement to the variable you are converting from character-format to numeric.&lt;BR /&gt;
&lt;BR /&gt;
Have a look at the SAS DOCUMENTATION on the SAS support website, where the topic about SAS DATE and DATETIME variables is discussed extensively -- URL link is  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; for reference.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks,Inc.</description>
      <pubDate>Tue, 07 Oct 2008 16:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/appending-data-sets-with-different-date-formats-solved/m-p/52366#M11075</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-10-07T16:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: appending data sets with different date formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/appending-data-sets-with-different-date-formats-solved/m-p/52367#M11076</link>
      <description>Thanks for the help.  That did it.</description>
      <pubDate>Tue, 07 Oct 2008 17:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/appending-data-sets-with-different-date-formats-solved/m-p/52367#M11076</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-07T17:29:48Z</dc:date>
    </item>
  </channel>
</rss>

