<?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 get rid of DATETIME format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/612979#M258269</link>
    <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 19 Dec 2019 10:33:01 GMT</pubDate>
    <dc:creator>CeCe</dc:creator>
    <dc:date>2019-12-19T10:33:01Z</dc:date>
    <item>
      <title>How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102739#M258260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I' have imported both csv and excel files into SAS, with exactly the same data. In excel, the birth_date has a datetime format of "10/25/1955 12:00:00 AM" symbolised by *DATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran this code to get the date in the format I need it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets library=data;&lt;/P&gt;&lt;P&gt;modify population_2012;&lt;/P&gt;&lt;P&gt;format birth_date ddmmyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;However when I run a proc export&amp;nbsp; both the csv/xls files I've exported still end up with the datetime. I need to clean up the date in SAS so that I can load the good xls data into DB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2012 16:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102739#M258260</guid>
      <dc:creator>Tumtum</dc:creator>
      <dc:date>2012-10-22T16:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102740#M258261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are two issues:&lt;/P&gt;&lt;P&gt;Your applying a DATE format to a DATETIME variable so it won't change anything. &lt;/P&gt;&lt;P&gt;PROC EXPORT doesn't export formats to XLS if you check the log.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll need to convert the variable to a date variable in a datastep or export it another way. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2012 16:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102740#M258261</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-10-22T16:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102741#M258262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc datasets library=data;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;modify population_2012;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format birth_date ddmmyy10.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You may want&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&amp;nbsp; population_2012;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_dob = birthdate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format new_dob&amp;nbsp; ddmmyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Then you may want to try to use ODS Tagset instead of export (be sure to change the &lt;STRONG&gt;bolded&lt;/STRONG&gt; items) (because the proc export does not keep formats)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods listing close;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods tagsets.excelxp path = &lt;STRONG&gt;"&amp;amp;output_path."&lt;/STRONG&gt; file="&lt;STRONG&gt;&amp;amp;data..xml&lt;/STRONG&gt;"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style=analysis&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; options(absolute_column_width='10,10,8,8,10,10,15,8,15,8,15,10,8,8,8,8,10,1­0,15,8,15,8,15,10,8,8,8,8,20'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sheet_label=' ');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods tagsets.excelxp options(sheet_name="sheetname");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc print noobs label data = &lt;STRONG&gt;&amp;amp;data.;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var &lt;STRONG&gt;your_variables;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods tagsets.excelxp close;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ods listing;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2012 16:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102741#M258262</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2012-10-22T16:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102742#M258263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can also use datepart function&lt;/P&gt;&lt;P&gt;It extracts the date section of a variable from its datetime &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2012 17:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102742#M258263</guid>
      <dc:creator>niam</dc:creator>
      <dc:date>2012-10-22T17:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102743#M258264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To convert a DATETIME variable to a DATE variable you must use the DATEPART function and assign a new format. For instance :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set population_2012;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;birth_date = datepart(birth_date);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format birth_date ddmmyy10.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;alternatively, you could simply give the variable a format that properly reflects its value and it should export without a problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc datasets library=data;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;modify population_2012;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;format birth_date datetime20.;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2012 17:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102743#M258264</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-10-22T17:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102744#M258265</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;This was really helpful...thank you so much! &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;P&gt;&lt;/P&gt;&lt;P&gt;Though I didnt quite understand the ODS Tagset bit ( it's my first time hearing of it)&amp;nbsp; - it worked out great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TumTum&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 10:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102744#M258265</guid>
      <dc:creator>Tumtum</dc:creator>
      <dc:date>2012-10-23T10:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102745#M258266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@PGStats&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The datepart function didn't give me the desired results - infact it defaults the new variable to "0" i.e. 01/01/1960.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 10:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102745#M258266</guid>
      <dc:creator>Tumtum</dc:creator>
      <dc:date>2012-10-23T10:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102746#M258267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds like you do NOT have datetime values in your SAS data.&amp;nbsp; Dates are stored as the number of days since 01JAN1960.&amp;nbsp; Datetime is stored as the number of seconds.&amp;nbsp; So trying to use the DATEPART() function on a date value will usually give you zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It really looks to me like your original problem is with Excel and not with SAS.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Why are you using Excel as an intermediary to load data from SAS into DB2?&amp;nbsp; Check if you have SAS/Access to DB2 licensed.&lt;/P&gt;&lt;P&gt;If you let Excel automatically read a text file (such as a CSV file) it can make a lot of mistakes. If you cannot write directly to DB2 or Excel format then I suggest manually importing the text file into Excel.&amp;nbsp; That will allow you to specify how it treats each variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 11:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102746#M258267</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-10-23T11:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102747#M258268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Start with understanding the differences in date and time handling between SAS and MS Excel.&amp;nbsp; SAS measures dates in days; and times and datetimes in seconds.&amp;nbsp; Excel measures times in fractions of a day, so dates are just the integer part of a datetimevalue.&amp;nbsp; Hence in Excel to 'convert' a datetime value to a date value you apply a format which ignores the fractional time content of the datetime value.&amp;nbsp; This approach will not work in SAS because of the orders of magnitude difference between the underlying datetime value and the corresponding date value.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;If you are using Proc Import to import import xls files then your site has licensed the SAS Access to PC File Formats product.&amp;nbsp; This product manages the conversion from Excel date or datetime values automatically (it also has to apply an offset because day zero for Excel is 0JAN1900 (ie 31DEC1899)). SAS imports numerical values as numbers unless it identifies a date, time or datetime format in Excel, in which case the conversion takes place and SAS applies an appropriate SAS date, time or datetime format to the output value.&amp;nbsp; The csv import process does the same, based on the formatted date/time/datetime values it encounters.&amp;nbsp; However, in older versions of SAS at least it will not recognise the format &lt;STRONG&gt;10/25/1955 12:00:00 AM &lt;/STRONG&gt;and will simply import the data as text.&amp;nbsp; This may be why the datepart function gave the result zero.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;You can make SAS datetime values "look" like date values using the DTDATE format.&amp;nbsp; But the underlying value is not changed.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;Your options thus are&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;do the conversion in Excel by simply changing the column format to a date format&lt;/LI&gt;&lt;LI&gt;write (or convert) a datastep to read the csv data using a date informat eg MMDDYY10 to read the date part only of the text datetime data&lt;/LI&gt;&lt;LI&gt;import the data from an xls sheet, check that the import has resulted in a numeric field in SAS, and apply the datepart function in a subsequent data or sql step in sas (also changing the format to a date format), as in response 2.&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 13:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/102747#M258268</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2012-10-23T13:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of DATETIME format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/612979#M258269</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 10:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-DATETIME-format/m-p/612979#M258269</guid>
      <dc:creator>CeCe</dc:creator>
      <dc:date>2019-12-19T10:33:01Z</dc:date>
    </item>
  </channel>
</rss>

