<?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: How to convert datetime to string date in SAS Enterprise guide 6.1 in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294193#M20087</link>
    <description>&lt;P&gt;DATEPART() -&amp;gt; Extract date portion&lt;/P&gt;
&lt;P&gt;PUT() -&amp;gt; Convert to string&lt;/P&gt;</description>
    <pubDate>Thu, 25 Aug 2016 21:03:11 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-08-25T21:03:11Z</dc:date>
    <item>
      <title>How to convert datetime to string date in SAS Enterprise guide 6.1</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294191#M20086</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have a table that has dates as a datetime fromat (example:&amp;nbsp;02FEB2015:00:00:00.000). I am trying to firgure out how I can convert this column into a string so it matches up with another table &amp;nbsp;with there date fromat as 2015-02-01 (as a string). I know there is the CAT funtcion but I do not know how to only select parts of the DAte time format to create the date string.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried converting it in a query builder with the following steps ( look at attchement for screenshots)&lt;/P&gt;&lt;P&gt;1.I put the datetime column in the select data field&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.select properties&lt;/P&gt;&lt;P&gt;3. change&lt;/P&gt;&lt;P&gt;4. selected the format that matched the other field.&lt;/P&gt;&lt;P&gt;once i did this the dates were no longer the same then what they were . The year was showin 1900 when all the years are 2015 etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the best way to get it in sring fromat by YYYY-MM-DD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then selected the datetime column and selected properies&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 12:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294191#M20086</guid>
      <dc:creator>sheller</dc:creator>
      <dc:date>2016-08-26T12:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert datetime to string date in SAS Enterprise guide 6.1</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294193#M20087</link>
      <description>&lt;P&gt;DATEPART() -&amp;gt; Extract date portion&lt;/P&gt;
&lt;P&gt;PUT() -&amp;gt; Convert to string&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 21:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294193#M20087</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-25T21:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert datetime to string date in SAS Enterprise guide 6.1</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294220#M20089</link>
      <description>&lt;P&gt;Working with DATES, DATETIMES&amp;nbsp;and Times you need to know what is actually stored. DATES store numbers of Days, Datetimes numbers of seconds (both base&amp;nbsp;with Jan 1, 1960 in SAS)&amp;nbsp;and TIME is number of seconds since midnight.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you say year looked like 1900 it makes me suspect that you were using Excel as that program uses a different base date (1 Jan 1900).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In either case changing the format does not change the underlying value. So a date expressed as a datetime will often be the base date or one day from it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 23:06:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294220#M20089</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-25T23:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert datetime to string date in SAS Enterprise guide 6.1</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294271#M20099</link>
      <description>&lt;P&gt;First, don't post example data or anything else in a Microsoft Office document. Nobody in his right mind opens such a file from the web, and the organizations that most people here work in have explicit provisions against it.&lt;/P&gt;
&lt;P&gt;Post a screenshot image if necessary, but provide data in a textual format or even better in a data step that reads data from a cards; block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To convert your SAS datetime value to the required string in a data step, use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;newvar = put(datepart(oldvar),yymmddd10.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2016 06:22:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/294271#M20099</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-26T06:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert datetime to string date in SAS Enterprise guide 6.1</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/465658#M30150</link>
      <description>&lt;P&gt;Implemented the logic - num to char date&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc contents data = temp.dov out = con noprint;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data con;&lt;BR /&gt;set con;&lt;BR /&gt;dp1 = datepart(crdate);&lt;BR /&gt;call symput ('date',put(dp1,date9.));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%put &amp;amp;date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dov_1;&lt;BR /&gt;&amp;nbsp;set dov_new;&lt;BR /&gt;&amp;nbsp;by subject instancename;&lt;BR /&gt;&amp;nbsp;if last.subject;&lt;BR /&gt;&amp;nbsp;doe = "&amp;amp;date";&lt;BR /&gt;&amp;nbsp;vd = put(datepart(visitdt),date9.);&lt;BR /&gt;&amp;nbsp;day_diff = intck("day", vd, "&amp;amp;date");&lt;BR /&gt;&amp;nbsp;if day_diff &amp;gt; 105;&lt;BR /&gt;&amp;nbsp;drop visitdt;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 12:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-datetime-to-string-date-in-SAS-Enterprise-guide-6/m-p/465658#M30150</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2018-05-29T12:02:36Z</dc:date>
    </item>
  </channel>
</rss>

