<?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 Get Year and Month together as Value not as format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185019#M265524</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I have to select values from a table based on months. I have to select last 3 months data. Have already tried the following -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;set a(obs=1); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;prev_2_mon_dt = intnx('month',date(),-2,'beginning');&lt;/P&gt;&lt;P&gt;prev_2_mon = year(prev_2_mon_dt)*100 + month(prev_2_mon_dt);&lt;/P&gt;&lt;P&gt;call symput('pr2mn',prev_2_mon);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data c;&lt;/P&gt;&lt;P&gt;set d;&lt;/P&gt;&lt;P&gt;if ordermth in (%eval(&amp;amp;pr2mn.),%eval(&amp;amp;pr2mn. + 1),%eval(&amp;amp;pr2mn. + 2));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it gives numebrs like - 201411,201412,&lt;SPAN style="color: #ff00ff;"&gt;&lt;STRONG&gt; 201413&lt;/STRONG&gt;&lt;/SPAN&gt; etc..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any other way to handle this issue ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Feb 2015 22:40:02 GMT</pubDate>
    <dc:creator>rajat051984</dc:creator>
    <dc:date>2015-02-26T22:40:02Z</dc:date>
    <item>
      <title>Get Year and Month together as Value not as format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185019#M265524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I have to select values from a table based on months. I have to select last 3 months data. Have already tried the following -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;set a(obs=1); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;prev_2_mon_dt = intnx('month',date(),-2,'beginning');&lt;/P&gt;&lt;P&gt;prev_2_mon = year(prev_2_mon_dt)*100 + month(prev_2_mon_dt);&lt;/P&gt;&lt;P&gt;call symput('pr2mn',prev_2_mon);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data c;&lt;/P&gt;&lt;P&gt;set d;&lt;/P&gt;&lt;P&gt;if ordermth in (%eval(&amp;amp;pr2mn.),%eval(&amp;amp;pr2mn. + 1),%eval(&amp;amp;pr2mn. + 2));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it gives numebrs like - 201411,201412,&lt;SPAN style="color: #ff00ff;"&gt;&lt;STRONG&gt; 201413&lt;/STRONG&gt;&lt;/SPAN&gt; etc..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any other way to handle this issue ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 22:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185019#M265524</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-02-26T22:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Get Year and Month together as Value not as format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185020#M265525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do your ordermth values look like?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 22:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185020#M265525</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-26T22:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Get Year and Month together as Value not as format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185021#M265526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They look like - 201410,201411, 201412,201501 etc..&lt;/P&gt;&lt;P&gt;They are calculated each time with the formula I used above. Year*100 + month.&lt;/P&gt;&lt;P&gt;It is calcualated from a timestamp but I don't have that timestamp information in the input file anymore..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 23:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185021#M265526</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-02-26T23:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get Year and Month together as Value not as format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185022#M265527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your formula would produce something like 20152 rather than 201502.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; prev_2_mon_dt = intnx('month',date(),-2,'beginning');&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('pr2mn',put(prev_2_mon_dt,yymmn6.));&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput('curmn',put(date(),yymmn6.));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data d;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input ordermth;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;201410&lt;/P&gt;&lt;P&gt;201411&lt;/P&gt;&lt;P&gt;201412&lt;/P&gt;&lt;P&gt;201501&lt;/P&gt;&lt;P&gt;201502&lt;/P&gt;&lt;P&gt;201503&lt;/P&gt;&lt;P&gt;201504&lt;/P&gt;&lt;P&gt;201505&lt;/P&gt;&lt;P&gt;201506&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;data c;&lt;/P&gt;&lt;P&gt;set d;&lt;/P&gt;&lt;P&gt;if &amp;amp;pr2mn. le ordermth le &amp;amp;curmn.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2015 23:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185022#M265527</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-26T23:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Get Year and Month together as Value not as format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185023#M265528</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>Thu, 26 Feb 2015 23:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-Year-and-Month-together-as-Value-not-as-format/m-p/185023#M265528</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-02-26T23:19:29Z</dc:date>
    </item>
  </channel>
</rss>

