<?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:Macro dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Re-Macro-dates/m-p/27964#M5159</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First learn about date literals to make it easier to use the macro variable.&amp;nbsp; You could write "01&amp;amp;mon"d to represent the first of the month.&lt;/P&gt;&lt;P&gt;Then learn about the INTNX function for how to convert a date.&amp;nbsp; You want to use MONTH interval and find the END of the interval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;%let mon=Dec2011;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;&amp;nbsp; date9 = intnx('month',"01&amp;amp;mon"d,0,'end');&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date9 date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "mon=&amp;amp;mon " date9= ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mon=Dec2011 date9=31DEC2011&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also do this in macro logic if you need it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;%let d=dec2011;&lt;/P&gt;&lt;P&gt;%let e=%sysfunc(intnx(month,"01&amp;amp;d"d,0,e),date9.);&lt;/P&gt;&lt;P&gt;%put e=&amp;amp;e;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e=31DEC2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let d=feb2012;&lt;/P&gt;&lt;P&gt;%let e=%sysfunc(intnx(month,"01&amp;amp;d"d,0,e),date9.);&lt;/P&gt;&lt;P&gt;%put e=&amp;amp;e;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e=29FEB2012&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 11 Mar 2012 14:17:31 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2012-03-11T14:17:31Z</dc:date>
    <item>
      <title>Re:Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Macro-dates/m-p/27963#M5158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; %Let mon - Dec2011 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use the above macro variable in a data step and create a month end&amp;nbsp; date variable in date9. format (like 31DEC2011) . Is there a easy way to do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data a;&lt;/P&gt;&lt;P&gt;date9 = 31dec2011(this is what i want to see in column date9.)&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;Thanks in advance for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Mar 2012 03:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Macro-dates/m-p/27963#M5158</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2012-03-11T03:27:39Z</dc:date>
    </item>
    <item>
      <title>Re:Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Macro-dates/m-p/27964#M5159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First learn about date literals to make it easier to use the macro variable.&amp;nbsp; You could write "01&amp;amp;mon"d to represent the first of the month.&lt;/P&gt;&lt;P&gt;Then learn about the INTNX function for how to convert a date.&amp;nbsp; You want to use MONTH interval and find the END of the interval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;%let mon=Dec2011;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;&amp;nbsp; date9 = intnx('month',"01&amp;amp;mon"d,0,'end');&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date9 date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put "mon=&amp;amp;mon " date9= ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mon=Dec2011 date9=31DEC2011&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also do this in macro logic if you need it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;%let d=dec2011;&lt;/P&gt;&lt;P&gt;%let e=%sysfunc(intnx(month,"01&amp;amp;d"d,0,e),date9.);&lt;/P&gt;&lt;P&gt;%put e=&amp;amp;e;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e=31DEC2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let d=feb2012;&lt;/P&gt;&lt;P&gt;%let e=%sysfunc(intnx(month,"01&amp;amp;d"d,0,e),date9.);&lt;/P&gt;&lt;P&gt;%put e=&amp;amp;e;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e=29FEB2012&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Mar 2012 14:17:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Macro-dates/m-p/27964#M5159</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-11T14:17:31Z</dc:date>
    </item>
    <item>
      <title>Re:Macro dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-Macro-dates/m-p/27965#M5160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 11 Mar 2012 15:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-Macro-dates/m-p/27965#M5160</guid>
      <dc:creator>vicky07</dc:creator>
      <dc:date>2012-03-11T15:09:15Z</dc:date>
    </item>
  </channel>
</rss>

