<?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 Date format required in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598089#M16249</link>
    <description>Hi, I want to create a new dataset wherein date format is in mmddyyyy hr mm ss am/pm. Pls share me informat and format code for date. I already tried datetime18. And datetime19. But not worked.&lt;BR /&gt;Thanks in advance</description>
    <pubDate>Mon, 21 Oct 2019 11:42:25 GMT</pubDate>
    <dc:creator>sanjaymane7</dc:creator>
    <dc:date>2019-10-21T11:42:25Z</dc:date>
    <item>
      <title>Date format required</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598089#M16249</link>
      <description>Hi, I want to create a new dataset wherein date format is in mmddyyyy hr mm ss am/pm. Pls share me informat and format code for date. I already tried datetime18. And datetime19. But not worked.&lt;BR /&gt;Thanks in advance</description>
      <pubDate>Mon, 21 Oct 2019 11:42:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598089#M16249</guid>
      <dc:creator>sanjaymane7</dc:creator>
      <dc:date>2019-10-21T11:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Date format required</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598091#M16250</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296098"&gt;@sanjaymane7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi, I want to create a new dataset wherein date format is in mmddyyyy hr mm ss am/pm. Pls share me informat and format code for date. I already tried datetime18. And datetime19. But not worked.&lt;BR /&gt;Thanks in advance&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can't display dates that way, you can however display date/time values that way. Is your variable actually a date/time value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The format is DATEAMPMw.d&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=fedsqlref&amp;amp;docsetTarget=n10z3a99teizmrn1n56oqsaroyix.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=fedsqlref&amp;amp;docsetTarget=n10z3a99teizmrn1n56oqsaroyix.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Also, no need to create a new data set, just change the format in the existing data set.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 13:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598091#M16250</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-21T13:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: Date format required</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598145#M16255</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296098"&gt;@sanjaymane7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi, I want to create a new dataset wherein date format is in mmddyyyy hr mm ss am/pm. Pls share me informat and format code for date. I already tried datetime18. And datetime19. But not worked.&lt;BR /&gt;Thanks in advance&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why does it matter what display format is attached to the DATETIME variable?&lt;/P&gt;
&lt;P&gt;Is your problem with creating the datetime value from a string that looks like your pattern? (an INFORMAT)&lt;/P&gt;
&lt;P&gt;Or is your problem with producing a report that writes the datetime values like your pattern? (a FORMAT)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would it be ok for either if you split the text into into pieces so you could read/write the date and the time components separately?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 14:16:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598145#M16255</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-21T14:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Date format required</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598148#M16257</link>
      <description>Hi, Not working this. I am trying to import csv file through infile statement. In file, date is available in mm/dd/yyyy hr:mm:ss AM/PM. File gets imported but date is appearing blank due to incorrect date format. I need correct informat and format date format. I tried DATEAMPMw.d but error is showing that "Invalid variable specification, DATEAMPMw.d. Variable name of the form X.X must be either First.X or Last X. The name DAT</description>
      <pubDate>Mon, 21 Oct 2019 14:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598148#M16257</guid>
      <dc:creator>sanjaymane7</dc:creator>
      <dc:date>2019-10-21T14:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Date format required</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598152#M16258</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296098"&gt;@sanjaymane7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi, Not working this. I am trying to import csv file through infile statement. In file, date is available in mm/dd/yyyy hr:mm:ss AM/PM. File gets imported but date is appearing blank due to incorrect date format. I need correct informat and format date format. I tried DATEAMPMw.d but error is showing that "Invalid variable specification, DATEAMPMw.d. Variable name of the form X.X must be either First.X or Last X. The name DAT&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Show use the data step code used to read the data set. Best would be to include a log with all of the messages from running the data step. Copy the text from the log and paste the copied text into a code box opened on the forum using the forum's {I} icon to preserve code and message layout.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 14:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598152#M16258</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-10-21T14:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Date format required</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598162#M16261</link>
      <description>&lt;P&gt;Use the ANYDTDTM informat to read it. Then attach whatever format you want to display the values.&amp;nbsp; Like DATETIME20.;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length dt 8;
  informat dt anydtdtm.;
  format dt datetime20.;
  infile cards dsd truncover;
  input dt;
  put dt=; 
cards;
12/30/2019 12:30:12 AM
12/30/2019 12:30:12 PM
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;dt=30DEC2019:00:30:12
dt=30DEC2019:12:30:12
&lt;/PRE&gt;
&lt;P&gt;Note care must by used when using ANYDTxxx informats to read dates in MDY or DMY order as how it interprets ambiguous values like 06/05/2019 will change based on your LOCALE settings.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2019 16:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/598162#M16261</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-21T16:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date format required</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/603052#M16895</link>
      <description>&lt;P&gt;Hi, It's correct code but didn't work on my data. Then, I used&amp;nbsp;mdyampm25. and it's worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for help&lt;/P&gt;</description>
      <pubDate>Sun, 10 Nov 2019 12:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/603052#M16895</guid>
      <dc:creator>sanjaymane7</dc:creator>
      <dc:date>2019-11-10T12:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date format required</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/603056#M16896</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296098"&gt;@sanjaymane7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, It's correct code but didn't work on my data. Then, I used&amp;nbsp;mdyampm25. and it's worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for help&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Using the more specific &lt;STRONG&gt;informat&lt;/STRONG&gt; of MDYAMPM. will avoid the risk of mis-understood month/day order that could happen with the ANYDTDTM informat. What &lt;STRONG&gt;format&lt;/STRONG&gt; you attach doesn't matter since it does not change the datetime values, just how they are printed.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Nov 2019 13:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-format-required/m-p/603056#M16896</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-10T13:53:55Z</dc:date>
    </item>
  </channel>
</rss>

