<?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 for last day of previous month when the data is numeric type in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910740#M44154</link>
    <description>&lt;P&gt;As in your &lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/First-and-last-day-of-previous-month/m-p/910273" target="_self"&gt;previous question,&lt;/A&gt;&amp;nbsp;we need to see the PROC CONTENTS results for this variable.&lt;/P&gt;</description>
    <pubDate>Sat, 06 Jan 2024 16:16:22 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-01-06T16:16:22Z</dc:date>
    <item>
      <title>Macro for last day of previous month when the data is numeric type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910738#M44153</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Enterprise Guide,&amp;nbsp;and I have many tables that contain a column that contains a date that is in the form, e.g. 20231231 or 20231031. The column is &lt;STRONG&gt;&lt;EM&gt;numeric type&lt;/EM&gt;&lt;/STRONG&gt; and I need a macro variable, which when I put it in the filter, will eject the data for the &lt;EM&gt;&lt;STRONG&gt;last day of the previous month.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data in the columns&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tijanagilic_0-1704556335883.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92344iF8357B3475A238EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tijanagilic_0-1704556335883.png" alt="tijanagilic_0-1704556335883.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And i want to be able to put macro, like this in any table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tijanagilic_1-1704556389245.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92345iB742C6F164DB8ED9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tijanagilic_1-1704556389245.png" alt="tijanagilic_1-1704556389245.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2024 15:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910738#M44153</guid>
      <dc:creator>tijanagilic</dc:creator>
      <dc:date>2024-01-06T15:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for last day of previous month when the data is numeric type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910740#M44154</link>
      <description>&lt;P&gt;As in your &lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/First-and-last-day-of-previous-month/m-p/910273" target="_self"&gt;previous question,&lt;/A&gt;&amp;nbsp;we need to see the PROC CONTENTS results for this variable.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2024 16:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910740#M44154</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-06T16:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for last day of previous month when the data is numeric type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910744#M44155</link>
      <description>&lt;P&gt;OK - so you've got just a number and not a SAS Date value in your data:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1704560028642.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92348i45E34AB147387CE1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1704560028642.png" alt="Patrick_0-1704560028642.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you want a macro variable with such a number for the last day of the previous month based on the date when you are running the code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let previous_month=%sysfunc(intnx(month,%sysfunc(today()),-1,e),yymmddn8.);
%put &amp;amp;=previous_month;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1704560113674.png" style="width: 679px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92349i6677D705CFE1CEC1/image-dimensions/679x56?v=v2" width="679" height="56" role="button" title="Patrick_1-1704560113674.png" alt="Patrick_1-1704560113674.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2024 16:56:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910744#M44155</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-01-06T16:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for last day of previous month when the data is numeric type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910747#M44156</link>
      <description>&lt;P&gt;No need to define a macro or even create a macro variable.&lt;/P&gt;
&lt;P&gt;Instead you can just call a macro function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Put this code into the value of your filter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sysfunc(intnx(month,%sysfunc(date()),-1,e),yymmddN8.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2024 01:04:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910747#M44156</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-07T01:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for last day of previous month when the data is numeric type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910748#M44157</link>
      <description>&lt;P&gt;I think it should be the YYMMDDN8. format, otherwise the date would come out as YY-MM-DD.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2024 22:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910748#M44157</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-01-06T22:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for last day of previous month when the data is numeric type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910770#M44158</link>
      <description>&lt;P&gt;Thank you! It worked&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2024 17:31:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910770#M44158</guid>
      <dc:creator>tijanagilic</dc:creator>
      <dc:date>2024-01-07T17:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for last day of previous month when the data is numeric type</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910891#M44159</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I think it should be the YYMMDDN8. format, otherwise the date would come out as YY-MM-DD.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thanks.&amp;nbsp; Updated the answer.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2024 16:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-for-last-day-of-previous-month-when-the-data-is-numeric/m-p/910891#M44159</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-08T16:03:52Z</dc:date>
    </item>
  </channel>
</rss>

