<?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: Invalid argument to function MONTH ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112971#M23319</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent, easy enough. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Oct 2013 16:31:15 GMT</pubDate>
    <dc:creator>AllSoEasy</dc:creator>
    <dc:date>2013-10-15T16:31:15Z</dc:date>
    <item>
      <title>Invalid argument to function MONTH ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112968#M23316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting "invalid argument" error to both the MONTH() function and YEAR() function, but I am confused because I don't see why the argument is invalid. The variable is "month_date" and here are two example observations:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="113"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="113"&gt;month_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;31Jul2010 0:00:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;31Jul2010 0:00:00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in SAS column properties the data format is listed as "DATETIME20." -- Why is this not a valid format for these functions which state in their documentation that they accept datetime variables? I must be missing something here..&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>Tue, 15 Oct 2013 14:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112968#M23316</guid>
      <dc:creator>AllSoEasy</dc:creator>
      <dc:date>2013-10-15T14:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid argument to function MONTH ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112969#M23317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When a SAS variable month_date is actually date/time values, then the following code does not work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;month(month_date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the following code should work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;month(datepart(month_date))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 14:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112969#M23317</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-10-15T14:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid argument to function MONTH ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112970#M23318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I don't see anywhere in MONTH and YEAR documentation that it accepts datetime variables. It only mentions it accepts date variables. As pointed out by Paige, datepart(datetimevariable) is the way to output a date out of a datetime and should fix your issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a clear distinction between dates (number of days since 01JAN1960) and datetimes (number of seconds since 01JAN1960).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 15:52:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112970#M23318</guid>
      <dc:creator>Vince28_Statcan</dc:creator>
      <dc:date>2013-10-15T15:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid argument to function MONTH ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112971#M23319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent, easy enough. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 16:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-argument-to-function-MONTH/m-p/112971#M23319</guid>
      <dc:creator>AllSoEasy</dc:creator>
      <dc:date>2013-10-15T16:31:15Z</dc:date>
    </item>
  </channel>
</rss>

