<?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: USE open code to create automatically  sas macro varaible in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549099#M152322</link>
    <description>&lt;P&gt;Consider creating the 1812 value at the same place you created the 1901 value, instead of in open code.&lt;/P&gt;</description>
    <pubDate>Sun, 07 Apr 2019 04:51:59 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2019-04-07T04:51:59Z</dc:date>
    <item>
      <title>USE open code to create automatically  sas macro varaible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549096#M152320</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Let's say that the user (person who run the sas program) define a sas macro varaible&lt;/P&gt;
&lt;P&gt;%let lastScore=1901;&lt;/P&gt;
&lt;P&gt;How can we create another&amp;nbsp;sas macro varaible that is called OneMonBefore that wil get value 1812 (one month before value of lastScore)&lt;/P&gt;
&lt;P&gt;How can we do it in open code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;Joe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2019 04:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549096#M152320</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-04-07T04:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: USE open code to create automatically  sas macro varaible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549097#M152321</link>
      <description>&lt;P&gt;Use the functions INTNX() to increment the month one back. You can use INPUTN() &amp;nbsp;and PUTC() to convert to a &amp;nbsp;date or use MDY() and SUBSTR() to convert it to a date. If may be easier overall to store it as a date entirely but you can customize it to your needs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some common examples of macro functions with dates and time is here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Macro-Variables-of-Date-and-Time/ta-p/475194" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Macro-Variables-of-Date-and-Time/ta-p/475194&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Let's say that the user (person who run the sas program) define a sas macro varaible&lt;/P&gt;
&lt;P&gt;%let lastScore=1901;&lt;/P&gt;
&lt;P&gt;How can we create another&amp;nbsp;sas macro varaible that is called OneMonBefore that wil get value 1812 (one month before value of lastScore)&lt;/P&gt;
&lt;P&gt;How can we do it in open code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;Joe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2019 04:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549097#M152321</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-07T04:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: USE open code to create automatically  sas macro varaible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549099#M152322</link>
      <description>&lt;P&gt;Consider creating the 1812 value at the same place you created the 1901 value, instead of in open code.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2019 04:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549099#M152322</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-04-07T04:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: USE open code to create automatically  sas macro varaible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549117#M152329</link>
      <description>&lt;P&gt;Let's assume that you want to interpret 1901 as meaning January of 2019.&lt;/P&gt;
&lt;P&gt;It is easy to use the INTNX() function to move a date by one month, put you need an actual date value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lastScore=1901;
%let OneMonBefore=%sysfunc(intnx(month,%sysfunc(inputn(&amp;amp;lastscore.01,yymmdd)),-1),yymmn4);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;2285  %put &amp;amp;=lastscore &amp;amp;=onemonbefore ;
LASTSCORE=1901 ONEMONBEFORE=1812&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Apr 2019 15:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/USE-open-code-to-create-automatically-sas-macro-varaible/m-p/549117#M152329</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-07T15:19:10Z</dc:date>
    </item>
  </channel>
</rss>

