<?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: Simple date reformatting help in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98694#M27770</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see two choices.&lt;/P&gt;&lt;P&gt;1) SAS did import it as a date and has just assigned a different format than you are used to.&lt;/P&gt;&lt;P&gt;2) SAS imported the variable as a character string. In which case you can use INPUT() function to create a new variable that is an actual date variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a simple test that will help you tell which it is.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set MYDATA ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put datevar= / datevar= best12. / datevar=date9. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is a date then you will get something like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=06/04/13&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=19513&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=04JUN2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is character you will get&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #339966;"&gt;NOTE 484-185: Format $DATE was not found or could not be loaded.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=06/04/13&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=06/04/13&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=06/04/13&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Aug 2013 20:59:37 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2013-08-02T20:59:37Z</dc:date>
    <item>
      <title>Simple date reformatting help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98692#M27768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've checked the archives and can't find the correct combination of clues for my problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am relatively new to reading data directly from Excel and dbf files.&amp;nbsp; I imported a dbf into a sas library and the date is formatted as for example, 06/04/13.&amp;nbsp; Normally when I import SAS converts it to the integer automatically, but this time for whatever reason it has retained the mmddyy10. format.&amp;nbsp; How do I reformat it to the simple integer value for a sas date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 19:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98692#M27768</guid>
      <dc:creator>iiibbb</dc:creator>
      <dc:date>2013-08-02T19:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Simple date reformatting help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98693#M27769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data required;&lt;/P&gt;&lt;P&gt;set yourSASdatasetname;&lt;/P&gt;&lt;P&gt;newdate=input(substr(strip(olddate),1,10),mmddyy10.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/32969?start=0&amp;amp;tstart=0"&gt;https://communities.sas.com/thread/32969?start=0&amp;amp;tstart=0&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 20:30:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98693#M27769</guid>
      <dc:creator>sassharp</dc:creator>
      <dc:date>2013-08-02T20:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Simple date reformatting help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98694#M27770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see two choices.&lt;/P&gt;&lt;P&gt;1) SAS did import it as a date and has just assigned a different format than you are used to.&lt;/P&gt;&lt;P&gt;2) SAS imported the variable as a character string. In which case you can use INPUT() function to create a new variable that is an actual date variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a simple test that will help you tell which it is.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set MYDATA ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put datevar= / datevar= best12. / datevar=date9. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is a date then you will get something like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=06/04/13&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=19513&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=04JUN2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is character you will get&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #339966;"&gt;NOTE 484-185: Format $DATE was not found or could not be loaded.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=06/04/13&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=06/04/13&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;datevar=06/04/13&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Aug 2013 20:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98694#M27770</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-08-02T20:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Simple date reformatting help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98695#M27771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code withe the back slashes in it didn't do anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know It is a date format because when I right-click the column in SAS explorer, it is listed as format mmddyy8. and informat yymmdd8..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also when I prob print with a format statement I can get it to change the output form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively, one could suggest how to merge a date formatted as above, and a time column formatted as character 04:46:56pm and output as a datetime integer.&amp;nbsp; That's really where I'm going with this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 12:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98695#M27771</guid>
      <dc:creator>iiibbb</dc:creator>
      <dc:date>2013-08-05T12:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Simple date reformatting help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98696#M27772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;okay... answered my own question and got what I was ultimately looking for by cobbling together some things I found.&amp;nbsp; I do work better on a Monday morning over a Friday afternoon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set b;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sas_DT = (datevariable * 24 * 60 * 60) + input(timevariable, time10.); /* datevariable is recognized by SAS as a date variable, timevariable is a character*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print;&lt;/P&gt;&lt;P&gt;format sas_DT datetime.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interestingly, by figuring this out I realized that I really dont't need to remember some formatting command I won't use very often, but instead just include the variable in a function and it will return as an integer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datevariabe_2 = datevariable + 1 - 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and sure enough... it output it as the integer I was after.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by the by can anyone tell me why the information on this page doesn't work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201272.htm" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201272.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have SAS 9.2, but it balked when I originally tried to use timeampmw.d&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 13:18:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98696#M27772</guid>
      <dc:creator>iiibbb</dc:creator>
      <dc:date>2013-08-05T13:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: Simple date reformatting help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98697#M27773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your link is to a FORMAT and not an INFORMAT.&amp;nbsp; Is that your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DHMS() function is useful for converting separate date and time values into a date time value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; dt = dhms(today(),0,0,time());&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put dt datetime.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 13:25:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98697#M27773</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-08-05T13:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Simple date reformatting help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98698#M27774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To show a SAS date as the integer value, simply refer to the date value without applying any formatting. Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data some_dates ;&lt;/P&gt;&lt;P&gt;input mydate :mmddyy10.;&lt;/P&gt;&lt;P&gt;integer_dt = mydate ;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1/1/2001&lt;/P&gt;&lt;P&gt;2/2/2002&lt;/P&gt;&lt;P&gt;3/3/2003&lt;/P&gt;&lt;P&gt;4/4/2004&lt;/P&gt;&lt;P&gt;5/5/2005&lt;/P&gt;&lt;P&gt;6/30/2006&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;;;;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note re: why the TIMEAMPM format isn't working for you. The TIMEAMPM format only works with SAS TIME and DATETIME values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Aug 2013 21:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Simple-date-reformatting-help/m-p/98698#M27774</guid>
      <dc:creator>Fugue</dc:creator>
      <dc:date>2013-08-05T21:03:34Z</dc:date>
    </item>
  </channel>
</rss>

