<?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: mreging two datsets with different date format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509312#M72932</link>
    <description>&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Oct 2018 20:11:05 GMT</pubDate>
    <dc:creator>Kyra</dc:creator>
    <dc:date>2018-10-31T20:11:05Z</dc:date>
    <item>
      <title>mreging two datsets with different date format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509280#M72927</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.one of my dataset contains date variable in 03/14/2018 format . There are many more variables too.&lt;/P&gt;&lt;P&gt;proc content shows the below about date -&lt;/P&gt;&lt;P&gt;&amp;nbsp;SAS Output&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Operation_Date&lt;/TD&gt;&lt;TD&gt;Char&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;$10.&lt;/TD&gt;&lt;TD&gt;$10.&lt;/TD&gt;&lt;TD&gt;Operation Date&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. another dataset contains date variable looking like this 11Jun2018&lt;/P&gt;&lt;P&gt;proc contents on this dataset shows below about the date&lt;/P&gt;&lt;P&gt;SAS Output&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;opdate&lt;/TD&gt;&lt;TD&gt;Num&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;DATE9.&lt;/TD&gt;&lt;TD&gt;DATE9.&lt;/TD&gt;&lt;TD&gt;opdate&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to merge both dataset by patient id and date, but i do not know how to convert both of the dates to same format to be able to merge. Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509280#M72927</guid>
      <dc:creator>Kyra</dc:creator>
      <dc:date>2018-10-31T19:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: mreging two datsets with different date format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509290#M72928</link>
      <description>&lt;P&gt;There is no problem merging on a date variable that might be using different display formats.&amp;nbsp; But that is NOT what you have. Instead you have one date variable and one character string. So you will need to convert the character string into a date so you can match the date values in your other dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one_fixed;
  set one;
  length opdate 8;
  opdate=input(operation_date,mmddyy10.);
  format opdate date9.;
run;
proc sort;
  by patid opdate;
run;

data want;
  merge one_fixed two ;
  by patid opdate;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509290#M72928</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-10-31T19:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: mreging two datsets with different date format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509291#M72929</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/186157"&gt;@Kyra&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.one of my dataset contains date variable in 03/14/2018 format . There are many more variables too.&lt;/P&gt;
&lt;P&gt;proc content shows the below about date -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;SAS Output&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Operation_Date&lt;/TD&gt;
&lt;TD&gt;Char&lt;/TD&gt;
&lt;TD&gt;10&lt;/TD&gt;
&lt;TD&gt;$10.&lt;/TD&gt;
&lt;TD&gt;$10.&lt;/TD&gt;
&lt;TD&gt;Operation Date&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. another dataset contains date variable looking like this 11Jun2018&lt;/P&gt;
&lt;P&gt;proc contents on this dataset shows below about the date&lt;/P&gt;
&lt;P&gt;SAS Output&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;opdate&lt;/TD&gt;
&lt;TD&gt;Num&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;TD&gt;DATE9.&lt;/TD&gt;
&lt;TD&gt;DATE9.&lt;/TD&gt;
&lt;TD&gt;opdate&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to merge both dataset by patient id and date, but i do not know how to convert both of the dates to same format to be able to merge. Please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have a choice as to which set to modify by adding a variable of the correct type and value range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest adding a date valued variable using input with Operation_date.&lt;/P&gt;
&lt;P&gt;In a data step:&lt;/P&gt;
&lt;P&gt;data temp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; opdate = input(operation_date,mmddyy10.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; format opdate date9.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;and then merge the resulting set using opdate after appropriate sorting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are many reasons to ensure date, time or datetime appearing values are actual SAS date, time or datetime valued variables created with the correct informat or functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:37:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509291#M72929</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-10-31T19:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: mreging two datsets with different date format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509312#M72932</link>
      <description>&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 20:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/mreging-two-datsets-with-different-date-format/m-p/509312#M72932</guid>
      <dc:creator>Kyra</dc:creator>
      <dc:date>2018-10-31T20:11:05Z</dc:date>
    </item>
  </channel>
</rss>

