<?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: PROC SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164215#M263588</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider not using SAS Macro code at all but something as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do date='01jan2004'd to '31dec2009'd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date=date+ceil(ranuni(0)*15);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&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;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value year_range&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; low - '31Dec2004'd&amp;nbsp; = 'upto2005'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '01Jan2008'd - high = '2008+'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; other&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = [year.]&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&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;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; intnx('month',date,0,'b') as month_date format=monyy5.,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(date) as count,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put(date,year_range.) as year&lt;/P&gt;&lt;P&gt;&amp;nbsp; from have&lt;/P&gt;&lt;P&gt;&amp;nbsp; group by calculated month_date, calculated year&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Aug 2014 22:24:05 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2014-08-17T22:24:05Z</dc:date>
    <item>
      <title>PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164211#M263584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;My code be&lt;SPAN style="text-decoration: underline;"&gt;lo&lt;/SPAN&gt;w runs but i'm not getting the required output and would appreciate some helps.&amp;nbsp; &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The Month_date Count and Year is the output table but as you can see the values are the same for each year by month_date where they should differ. I have my CASE statement to help me do this but I cant seem to get it to work. I don't think i'm too far off but im new to this so unsure on the next steps.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG&gt;OUTPUT&lt;/STRONG&gt; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="border: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; width: 234px; background-color: rgb(255, 255, 255);" summary="Page Layout"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="xl64" height="20" style="padding-right: 4px; padding-left: 4px; border: 0px solid black; font-style: inherit; font-family: inherit;" width="120"&gt;month_date&lt;/TD&gt;&lt;TD class="xl65" style="padding-right: 4px; padding-left: 4px; border-width: 0px 0px 0px medium; border-style: solid solid solid none; border-top-color: black; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;count&lt;/TD&gt;&lt;TD class="xl66" style="padding-right: 4px; padding-left: 4px; border-width: 0px 0px 0px medium; border-style: solid solid solid none; border-top-color: black; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;year&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Aug-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4288&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2005&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Aug-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4288&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2006&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Aug-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4288&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2007&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Aug-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4288&lt;/TD&gt;&lt;TD class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2008+&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Aug-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4288&lt;/TD&gt;&lt;TD class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;&amp;nbsp; upto2005&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Sep-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4262&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2005&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Sep-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4262&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2006&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Sep-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4262&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2007&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Sep-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4262&lt;/TD&gt;&lt;TD class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2008+&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Sep-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4262&lt;/TD&gt;&lt;TD class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;&amp;nbsp; upto2005&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Oct-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4123&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2005&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Oct-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4123&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2006&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Oct-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4123&lt;/TD&gt;&lt;TD align="right" class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;2007&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Oct-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4123&lt;/TD&gt;&lt;TD class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2008+&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD align="right" class="xl67" height="19" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px; border-style: none solid solid; border-right-color: black; border-bottom-color: black; border-left-color: black; font-style: inherit; font-family: inherit;" width="120"&gt;Oct-12&lt;/TD&gt;&lt;TD align="right" class="xl63" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="47"&gt;4123&lt;/TD&gt;&lt;TD class="xl68" style="padding-right: 4px; padding-left: 4px; border-width: medium 0px 0px medium; border-style: none solid solid none; border-right-color: black; border-bottom-color: black; font-style: inherit; font-family: inherit;" width="67"&gt;upto2005&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;CODE&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; %macro vintage_value(A1,A2);&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sql;&lt;BR /&gt;create table work.kptarrears_vintagevalue_&amp;amp;A1. as&lt;BR /&gt;select distinct month_date, &lt;BR /&gt;count(*) as count, &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;case when completion &amp;lt; '01jan2005'd then 'upto2005' &lt;BR /&gt;when completion between '01Jan2005'd and '31dec2005'd then '2005'&lt;BR /&gt;when completion between '01Jan2006'd and '31dec2006'd then '2006'&lt;BR /&gt;when completion between '01Jan2007'd and '31dec2007'd then '2007'&lt;BR /&gt;else '2008+' end as year&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;from gbasel.basel&amp;amp;A2.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;where optimum_platform = 'Optimum'&lt;BR /&gt;and arrears_multiplier &amp;gt;= 3&lt;BR /&gt;and Arrears_lit_stage_code not in ('L4','L5','L6')&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;group by month_date;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sort data = work.kptarrears_vintagevalue_&amp;amp;A1.;&lt;BR /&gt;by month_date;&lt;BR /&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend vintage_value;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%vintage_value(201407,jul14);&lt;BR /&gt;%vintage_value(201406,jun14);&lt;BR /&gt;%vintage_value(201405,may14);&lt;BR /&gt;%vintage_value(201404,apr14);&lt;BR /&gt;%vintage_value(201403,mar14);&lt;BR /&gt;%vintage_value(201402,feb14);&lt;BR /&gt;%vintage_value(201401,jan14);&lt;BR /&gt;%vintage_value(201312,dec13);&lt;BR /&gt;%vintage_value(201311,nov13);&lt;BR /&gt;%vintage_value(201310,oct13);&lt;BR /&gt;%vintage_value(201309,sep13);&lt;BR /&gt;%vintage_value(201308,aug13);&lt;BR /&gt;%vintage_value(201307,jul13);&lt;BR /&gt;%vintage_value(201306,jun13);&lt;BR /&gt;%vintage_value(201305,may13);&lt;BR /&gt;%vintage_value(201304,apr13);&lt;BR /&gt;%vintage_value(201303,mar13);&lt;BR /&gt;%vintage_value(201302,feb13);&lt;BR /&gt;%vintage_value(201301,jan13);&lt;BR /&gt;%vintage_value(201212,dec12);&lt;BR /&gt;%vintage_value(201211,nov12);&lt;BR /&gt;%vintage_value(201210,oct12);&lt;BR /&gt;%vintage_value(201209,sep12);&lt;BR /&gt;%vintage_value(201208,aug12);&lt;BR /&gt;data allvintage_value;&lt;BR /&gt;set &lt;BR /&gt;kptarrears_vintagevalue_201208 kptarrears_vintagevalue_201209 kptarrears_vintagevalue_201210 &lt;BR /&gt;kptarrears_vintagevalue_201211 kptarrears_vintagevalue_201212 kptarrears_vintagevalue_201301 kptarrears_vintagevalue_201302 kptarrears_vintagevalue_201303 kptarrears_vintagevalue_201304 kptarrears_vintagevalue_201305 kptarrears_vintagevalue_201306 kptarrears_vintagevalue_201307 &lt;BR /&gt;kptarrears_vintagevalue_201308 kptarrears_vintagevalue_201309 kptarrears_vintagevalue_201310 kptarrears_vintagevalue_201311 kptarrears_vintagevalue_201312 kptarrears_vintagevalue_201401 &lt;BR /&gt;kptarrears_vintagevalue_201402 kptarrears_vintagevalue_201403 kptarrears_vintagevalue_201404 kptarrears_vintagevalue_201405 kptarrears_vintagevalue_201406 kptarrears_vintagevalue_201407;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Aug 2014 08:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164211#M263584</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2014-08-16T08:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164212#M263585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;group by &lt;STRONG&gt;calculated year&lt;/STRONG&gt; month_date;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Aug 2014 11:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164212#M263585</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-08-16T11:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164213#M263586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This doesn't seem to work, any reason as to why this might be?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Aug 2014 19:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164213#M263586</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2014-08-17T19:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164214#M263587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you put a comma in Stat's suggestion?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;group by &lt;STRONG&gt;calculated year,&lt;/STRONG&gt; month_date;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also it would be very helpful to us if you are a little bit more precise in your answers. For example "it doesn't seem to work" could be "I get an error in my SAS log and the error is ......" or "the code runs without error but doesn't produce the expected output. This is what I am getting....and this is what I want.....". The bonus is you will get this fixed quicker!&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Aug 2014 20:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164214#M263587</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2014-08-17T20:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164215#M263588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider not using SAS Macro code at all but something as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do date='01jan2004'd to '31dec2009'd;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date=date+ceil(ranuni(0)*15);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&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;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value year_range&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; low - '31Dec2004'd&amp;nbsp; = 'upto2005'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '01Jan2008'd - high = '2008+'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; other&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = [year.]&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&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;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; intnx('month',date,0,'b') as month_date format=monyy5.,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; count(date) as count,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put(date,year_range.) as year&lt;/P&gt;&lt;P&gt;&amp;nbsp; from have&lt;/P&gt;&lt;P&gt;&amp;nbsp; group by calculated month_date, calculated year&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Aug 2014 22:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164215#M263588</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-08-17T22:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164216#M263589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, missed comma. Thanks SASKiwi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;group by &lt;STRONG&gt;calculated year,&lt;/STRONG&gt; month_date;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Aug 2014 22:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL/m-p/164216#M263589</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-08-17T22:40:24Z</dc:date>
    </item>
  </channel>
</rss>

