<?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: Help to convert this hard coding to a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80889#M17418</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wasn't sure of how to calculate "Balance %" (percent of which total?) but else below code should do what you asked for. You might want to give the datasets different names now that everything is done in one go.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data RAW_DATA_SET_3;&lt;BR /&gt;&amp;nbsp; inFormat Current_date date9.;&lt;BR /&gt;&amp;nbsp; input Bank_number Account_number $ 4-12 Current_date Product $ 24-36 Balance Arrears_Band $43-49;&lt;BR /&gt;&amp;nbsp; format Current_date date9.;&lt;BR /&gt;&amp;nbsp; cards;&lt;BR /&gt;10 1111111&amp;nbsp;&amp;nbsp; 31MAR2010 Personal Loan 555&amp;nbsp; 30 - 60&lt;BR /&gt;10 1111111&amp;nbsp;&amp;nbsp; 30APR2010 Personal Loan 200&amp;nbsp; Current&lt;BR /&gt;10 1111111&amp;nbsp;&amp;nbsp; 31MAY2010 Personal Loan 108&amp;nbsp; 1 - 30&lt;BR /&gt;30 1111111&amp;nbsp;&amp;nbsp; 31DEC2010 Res. Mortgage 800&amp;nbsp; Current&lt;BR /&gt;30 1111111&amp;nbsp;&amp;nbsp; 31JAN2011 Res. Mortgage 600&amp;nbsp; 90 +&lt;BR /&gt;30 1111111&amp;nbsp;&amp;nbsp; 28FEB2011 Res. Mortgage 600&amp;nbsp; NPNA&lt;BR /&gt;30 1111111&amp;nbsp;&amp;nbsp; 17MAR2011 Res. Mortgage 600&amp;nbsp; writoff&lt;BR /&gt;20 333333333 15MAR2010 Personal OD&amp;nbsp;&amp;nbsp; 700&amp;nbsp; NPNA&lt;BR /&gt;20 333333333 30APR2010 Personal OD&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;20 333333333 31MAY2010 Personal OD&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;20 333333333 30JUN2010 Personal OD&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;10 444444444 28FEB2010 Personal Loan 900&amp;nbsp; 1 - 30&lt;BR /&gt;10 444444444 31MAR2010 Personal Loan 800&amp;nbsp; 60 - 90&lt;BR /&gt;10 444444444 31MAY2010 Personal Loan 20&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;10 444444444 01JUL2010 Personal Loan 25&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;10 444444444 30AUG2010 Personal Loan 32&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;70 666666666 07FEB2010 Personal OD&amp;nbsp;&amp;nbsp; 999&amp;nbsp; Current&lt;BR /&gt;70 666666666 15MAR2010 Personal OD&amp;nbsp;&amp;nbsp; 666&amp;nbsp; Current&lt;BR /&gt;40 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 08FEB2010 Res. Mortgage 1877 Current&lt;BR /&gt;40 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 28MAR2010 Res. Mortgage 905&amp;nbsp; Current&lt;BR /&gt;80 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 01FEB2010 Personal Loan 3000 90 +&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* create format for date cycle */&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create view v_cyclefmt as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Cycle2Month' as fmtname&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,'n' as type&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,current_date as start&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,catx(' ',put(intnx('month',current_date,-1,'b'),monname.),put(intnx('month',current_date,-1,'b'),year4.),'to',put(current_date,monname.)) as label&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from RAW_DATA_SET_3&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format cntlin=v_cyclefmt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* create format for sort order of Arrears_Band&amp;nbsp; */&lt;BR /&gt;proc format ;&lt;BR /&gt;&amp;nbsp; invalue ArrearsCode &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'CURRENT' =1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '1-30'&amp;nbsp;&amp;nbsp;&amp;nbsp; =2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '30-60'&amp;nbsp;&amp;nbsp; =3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '60-90'&amp;nbsp;&amp;nbsp; =4&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '90+'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =5&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'NPNA'&amp;nbsp;&amp;nbsp;&amp;nbsp; =6&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'WRITOFF' =7&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OTHER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =99&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; value ArrearsText &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1='Current'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2='1 - 30'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3='30 - 60'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4='60 - 90'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5='90 +' &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6='NPNA'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7='writoff'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 99='misscoded!'&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Sorting*/&lt;BR /&gt;proc sort data= RAW_DATA_SET_3 out=RAW_DATA_SET_3_sorted;&lt;BR /&gt;&amp;nbsp; by bank_number account_number current_date;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data Cycle_FEB_TO_MAR_2010_iso_;&lt;BR /&gt;&amp;nbsp; set RAW_DATA_SET_3_sorted;&lt;BR /&gt;&amp;nbsp; by bank_number account_number current_date;&lt;BR /&gt;&amp;nbsp; Arrears_Band_CD=input(upcase(compress(Arrears_Band)),ArrearsCode.);&lt;BR /&gt;&amp;nbsp; prior_Arrears_Band_CD = lag( Arrears_Band_CD );&lt;BR /&gt;&amp;nbsp; if intck('month',lag(current_date),current_date) ne 1 then call missing(prior_Arrears_Band_CD);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.account_number or missing(prior_Arrears_Band_CD) then delete;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options missing=' ';&lt;BR /&gt;proc tabulate data= Cycle_FEB_TO_MAR_2010_iso_ order=formatted;&lt;BR /&gt;&amp;nbsp; format current_date Cycle2Month. Arrears_Band_CD prior_Arrears_Band_CD ArrearsText.;&lt;BR /&gt;&amp;nbsp; label current_date='Cycle';&lt;BR /&gt;&amp;nbsp; class current_date / order=unformatted ;&lt;BR /&gt;&amp;nbsp; class prior_Arrears_Band_CD / order=unformatted;&lt;BR /&gt;&amp;nbsp; class Arrears_Band_CD / order=unformatted;&lt;BR /&gt;&amp;nbsp; var balance;&lt;BR /&gt;&amp;nbsp; table&amp;nbsp; current_date, prior_Arrears_Band_CD='', Arrears_Band_CD*(n balance*sum)/ box=prior_Arrears_Band_CD printmiss;&lt;BR /&gt;&amp;nbsp; Title 'Succession of O/S Balance ($ and %) and Accounts (#)';&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Oct 2012 01:18:52 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2012-10-01T01:18:52Z</dc:date>
    <item>
      <title>Help to convert this hard coding to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80885#M17414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #666699;"&gt;&lt;STRONG style="font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Hi SAS Forum,&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666699;"&gt;&lt;STRONG style="font-size: 11pt; background: white; font-family: 'Courier New';"&gt;Could you please help me to convert this hard code to a macro. &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #666699;"&gt;&lt;STRONG style="font-size: 11pt; background: white; font-family: 'Courier New';"&gt;I am a macro beginner.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;/*Below are the hard coded statements*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_FEB_TO_MAR_2010;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; RAW_DATA_SET_3_sorted;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;if&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;'1FEB2010'd&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; le current_date le &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;'30MAR2010'd&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; /*This was how I tried to convert the above into a macro as I need to repeat the above same code 24 times*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; t_1='1FEB2010'd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; t_2='31MAR2010'd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%substr&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(&amp;amp;t_1,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;)_TO_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%substr&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(&amp;amp;t_2,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;3&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;5&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;)_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%substr&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(&amp;amp;t_1,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;5&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;8&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; RAW_DATA_SET_3_sorted;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &amp;amp;t_1 le current_date le &amp;amp;t_2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Problem:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;I warning comes and get stuck.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;WARNING: Argument 3 to macro function %SUBSTR is out of range.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;Could any one help?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;Mirisage&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Sep 2012 03:31:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80885#M17414</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-09-30T03:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help to convert this hard coding to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80886#M17415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason for this error is that you the 3rd argument in a substr() function defines the length of the substring you want to read and not the end position.&lt;/P&gt;&lt;P&gt;substr(&amp;lt;source string&amp;gt;,&amp;lt;start position&amp;gt;,&amp;lt;length&amp;gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%substr&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(&amp;amp;t_1,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New'; font-size: 11pt;"&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New'; font-size: 11pt;"&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;); &lt;/SPAN&gt;instructs SAS to read string&amp;nbsp; '1FEB2010'd starting from position 5 and then reading the next 8 characters. Your string is not long enough for this so you're getting an error.&lt;/P&gt;&lt;P&gt;I assume that's what you're actually after: Cycle_%substr(&amp;amp;t_1,3,3)_TO_%substr(&amp;amp;t_2,4,3)_%substr(&amp;amp;t_1,6,4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case you just want to split up a large data set into smaller datasets based on date ranges: I can think of more straightforward ways of doing this. Is this what you want to do and are your cycles just consecutive 2 month ranges?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know why you need to split up your data into several smaller datasets. It is often better/easier to code if you leave everything in one big dataset and then subset the data later on as you need it or to use by group processing in procedures (instead of calling them x-times with different datasets).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could for examle create a cycle date variable which you then use in the by group (or class statement) of procedures. Just to give you the general idea of how to create such a group variable below some sample code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data RAW_DATA_SET_3_sorted;&lt;BR /&gt;&amp;nbsp; format current_date date9.;&lt;BR /&gt;&amp;nbsp; do current_date='01Jan2010'd to '3Sep2012'd by 27;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want;&lt;BR /&gt;&amp;nbsp; set RAW_DATA_SET_3_sorted;&lt;BR /&gt;&amp;nbsp; by current_date;&lt;BR /&gt;&amp;nbsp; format CycleStartDate CycleEndDate date9.;&lt;BR /&gt;&amp;nbsp; length CycleDSname $21;&lt;BR /&gt;&amp;nbsp; CycleStartDate=intnx('month2.2',current_date,0,'b');&lt;BR /&gt;&amp;nbsp; CycleEndDate=intnx('month2.2',current_date,0,'e');&lt;BR /&gt;&amp;nbsp; CycleDSname=&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cats('Cycle_',put(CycleStartDate,monname3.),'_To_'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,put(CycleEndDate,monname3.),'_',year(CycleStartDate)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Sep 2012 04:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80886#M17415</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-09-30T04:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help to convert this hard coding to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80887#M17416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mirisage,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does the following do what you are trying to accomplish?:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data RAW_DATA_SET_3_sorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input current_date date9.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1jan2010&lt;/P&gt;&lt;P&gt;10jan2010&lt;/P&gt;&lt;P&gt;15feb2010&lt;/P&gt;&lt;P&gt;31mar2010&lt;/P&gt;&lt;P&gt;1apr2010&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let t_1=1FEB2010;&lt;/P&gt;&lt;P&gt;%let t_2=31MAR2010;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Cycle_%sysfunc(substr(&amp;amp;t_1,%sysfunc(anyalpha(&amp;amp;t_1)),3))_TO_%sysfunc(substr(&amp;amp;t_2,%sysfunc(anyalpha(&amp;amp;t_2)),3))_%sysfunc(substr(&amp;amp;t_1,%sysfunc(anyalpha(&amp;amp;t_1))+3,4));&lt;/P&gt;&lt;P&gt;&amp;nbsp; set RAW_DATA_SET_3_sorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if "&amp;amp;t_1"d le current_date le "&amp;amp;t_2"d;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Sep 2012 16:37:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80887#M17416</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-09-30T16:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help to convert this hard coding to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80888#M17417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Hi Patrick and Art,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Many thanks to both of you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I think this is the good time to show how inefficiently I have achieved what I wanted to achieve.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Using the data set (shown at the very bottom, can be run readily), I wanted to create 23 Markov Matrices/Tables for consecutive months, commencing Feb 2010 to Mar 2010 pair, culminating &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;Dec 2011 to Jan 2012 pair.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #339966; font-size: 11pt;"&gt;/*This is the first Table I generated using my novice code provided further down*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Succession of O/S Balance ($ and %) and Accounts (#) from Feb 2010 to Mar 2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="padding-bottom: 0px; padding-left: 5.4pt; padding-right: 5.4pt; margin-left: 4.9pt; padding-top: 0px;" width="583"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD rowspan="4" style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: #333333 1pt solid; border-right: medium none;" width="169"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;prior_arrears_band&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="6" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: black 1pt solid;" valign="bottom" width="414"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Areeras_Band&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD colspan="3" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: black 1pt solid;" valign="bottom" width="207"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="3" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: black 1pt solid;" valign="bottom" width="207"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;60 - 90&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD rowspan="2" style="border-bottom: medium none; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: #333333 1pt solid;" valign="bottom" width="54"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;N&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Balance&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Balance &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD rowspan="2" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: #333333 1pt solid;" valign="bottom" width="54"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;N&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Balance&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Balance &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Sum&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;%&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Sum&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;%&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="top" width="169"&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Current&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;1571&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="top" width="169"&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt; 1 - 30&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;800&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #339966; font-size: 11pt;"&gt;/*This is the second Table I generated*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: normal;"&gt;Succession of O/S Balance ($ and %)) and Accounts (#) from Mar 2010 to Apr 2010&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="padding-bottom: 0px; padding-left: 5.4pt; padding-right: 5.4pt; margin-left: 4.9pt; padding-top: 0px;" width="583"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD rowspan="4" style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: #333333 1pt solid; border-right: medium none;" width="169"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;prior_arrears_band&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="6" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: black 1pt solid;" valign="bottom" width="414"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Areeras_Band&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD colspan="3" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: black 1pt solid;" valign="bottom" width="207"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="3" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: black 1pt solid;" valign="bottom" width="207"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;60 - 90&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD rowspan="2" style="border-bottom: medium none; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: #333333 1pt solid;" valign="bottom" width="54"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;N&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Balance&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Balance &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD rowspan="2" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: #333333 1pt solid;" valign="bottom" width="54"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;N&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Balance&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Balance &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Sum&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;%&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Sum&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;%&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="top" width="169"&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;30 - 60&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;200&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="top" width="169"&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;NPNA&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;30&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Next, ..... Apr 2010 to May 2010 table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;May 2010 to Jun 2010 table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Jun&amp;nbsp; 2010 to Jul&amp;nbsp; 2010 table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;……………………………………………..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;…………………………………………………&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;……………………………………………….&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Dec 2011 to Jan 2012 table (this is the last table)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This is the inefficient (but hopefully correct) approach I have taken. (Data set is provided at the very bottom that can be readily run).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966; font-size: 10pt;"&gt;/*Sorting*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;= RAW_DATA_SET_3 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=RAW_DATA_SET_3_sorted;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; bank_number account_number current_date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*Isolating only accounts occur any day between 1Feb2010 and 31Mar2010 (consecutive pairs of 2 months). Note that some accounts may not occur in pairs*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_FEB_TO_MAR_2010;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; RAW_DATA_SET_3_sorted;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;if&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;'1FEB2010'd&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; le current_date le &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;'31MAR2010'd&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;/*&lt;SPAN style="color: #339966;"&gt;sorting again&lt;/SPAN&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=Cycle_FEB_TO_MAR_2010 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;= Cycle_FEB_TO_MAR_2010_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; bank_number account_number current_date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*Getting rid of single records. In other words, isolating only consecutive pairs */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_FEB_TO_MAR_2010_iso;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_FEB_TO_MAR_2010_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; bank_number account_number current_date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; (first.account_number &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; last.account_number);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*getting the preceeding month's arrears_band into the succeeding month's row*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_FEB_TO_MAR_2010_iso;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_FEB_TO_MAR_2010_iso;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prior_arrears_band = lag( arrears_band );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*Removing Preceeding month rows, or in other words, retaining succeeding month's row*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*This retained row now has both preceeding month's arrers band and succeeding month's &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;arrears band*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_FEB_TO_MAR_2010_iso_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Cycle_FEB_TO_MAR_2010_iso;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;if&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;'1MAR2010'd&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; le current_date le &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;'31MAR2010'd&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-family: 'Courier New'; background: white; color: #339966; font-size: 11pt;"&gt;/*User defined format to control the column and row title orders*/ &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;format&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; $ fmt (&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;multilabel&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;notsorted&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'Current'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'Current'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'1 - 30'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'1 - 30'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'30 - 60'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'30 - 60'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'60 - 90'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'60 - 90'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'90 +'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'90 +'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'NPNA'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'NPNA'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'writoff'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'writoff'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*This proc tabulate works but row title order not work*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;tabulate&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;= Cycle_FEB_TO_MAR_2010_iso_ &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;order&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=formatted;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;class&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; prior_arrears_band /&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;PRELOADFMT&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;order&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*row CLASS statement*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;class&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; arrears_band /&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;PRELOADFMT&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;order&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*column CLASS statement*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; balance;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; prior_arrears_band=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;''&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;, arrears_band*(n balance*sum)/ &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;box&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=prior_arrears_band;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; arrears_band &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;$fmt.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*applying the earlier defined format*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;Title&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'Succession of O/S Balance ($ and %) and Accounts (#) from Feb 2010 to Mar 2010'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;This is the final first table I generated (except balance % columns) using my novice code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="center" class="systemtitle" style="text-align: center;"&gt;&lt;SPAN class="systemtitle1"&gt;Succession of O/S Balance ($ and %) and Accounts (#) from Feb 2010 to Mar 2010&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="padding-bottom: 0px; padding-left: 5.4pt; padding-right: 5.4pt; margin-left: 4.9pt; padding-top: 0px;" width="583"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD rowspan="4" style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: #333333 1pt solid; border-right: medium none;" width="169"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;prior_arrears_band&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="6" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: black 1pt solid;" valign="bottom" width="414"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Arreras_Band&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD colspan="3" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: black 1pt solid;" valign="bottom" width="207"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Current&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="3" nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: black 1pt solid;" valign="bottom" width="207"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;60 - 90&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD rowspan="2" style="border-bottom: medium none; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: #333333 1pt solid;" valign="bottom" width="54"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;N&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Balance&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Balance &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD rowspan="2" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: #333333 1pt solid;" valign="bottom" width="54"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;N&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Balance&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;Balance &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Sum&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;%&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="81"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Sum&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;%&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="top" width="169"&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt;Current&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;2&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;1571&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: medium none; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: #333333 1pt solid; border-left: #333333 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; background: #ffffcc; border-top: medium none; border-right: medium none;" valign="top" width="169"&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; font-family: Arial;"&gt; 1 - 30&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="54"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: medium none;" valign="bottom" width="81"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman';"&gt;800&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD nowrap="nowrap" style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; background: #99ccff; border-top: medium none; border-right: windowtext 1pt solid;" valign="bottom" width="72"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;SPAN style="font-family: Arial; font-size: 10pt;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 11pt; background: white; text-decoration: underline; font-family: 'Courier New';"&gt;Above markov table says:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 11pt;"&gt;2 accounts have cycled from “Current” bucket in FEB2010 (preceeding month) to “Current” bucket in MAR2010 (succeeding month).&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&amp;nbsp; &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 11pt;"&gt;The corresponding $ amount is $1,571 (i.e. 666+905) &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 11pt;"&gt;1 account has cycled from “1-30” bucket in FEB2010 (preceeding month) to “60-90” bucket in MAR2010 (succeeding month).&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&amp;nbsp; &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; font-size: 11pt;"&gt;The corresponding $ amount is $800&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Next I have to repeat this exercise for the &lt;/SPAN&gt;&lt;SPAN style="font-weight: normal;"&gt;Mar 2010 to Apr 2010 cycle and so on, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;culminating &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;Dec 2011 to Jan 2012 cycle.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;I know no body can read all these things, but appreciate if any help to make my code efficent, if time permits.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;This is dataset used.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; RAW_DATA_SET_3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;inFormat&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Current_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Bank_number Account_number $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;4&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Current_date&amp;nbsp;&amp;nbsp;&amp;nbsp; Product&amp;nbsp;&amp;nbsp;&amp;nbsp; $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;24&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;36&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Balance&amp;nbsp;&amp;nbsp;&amp;nbsp; Arrears_Band $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;43&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;49&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; Current_date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;date9.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;10 1111111&amp;nbsp;&amp;nbsp; 31MAR2010 Personal Loan 555&amp;nbsp; 30 - 60&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;10 1111111&amp;nbsp;&amp;nbsp; 30APR2010 Personal Loan 200&amp;nbsp; Current&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;10 1111111&amp;nbsp;&amp;nbsp; 31MAY2010 Personal Loan 108&amp;nbsp; 1 - 30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30 1111111&amp;nbsp;&amp;nbsp; 31DEC2010 Res. Mortgage 800&amp;nbsp; Current&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30 1111111&amp;nbsp;&amp;nbsp; 31JAN2011 Res. Mortgage 600&amp;nbsp; 90 +&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30 1111111&amp;nbsp;&amp;nbsp; 28FEB2011 Res. Mortgage 600&amp;nbsp; NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;30 1111111&amp;nbsp;&amp;nbsp; 17MAR2011 Res. Mortgage 600&amp;nbsp; writoff&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;20 333333333 15MAR2010 Personal OD&amp;nbsp;&amp;nbsp; 700&amp;nbsp; NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;20 333333333 30APR2010 Personal OD&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp; NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;20 333333333 31MAY2010 Personal OD&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;20 333333333 30JUN2010 Personal OD&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;10 444444444 28FEB2010 Personal Loan 900&amp;nbsp; 1 - 30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;10 444444444 31MAR2010 Personal Loan 800&amp;nbsp; 60 - 90&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;10 444444444 31MAY2010 Personal Loan 20&amp;nbsp;&amp;nbsp; NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;10 444444444 01JUL2010 Personal Loan 25&amp;nbsp;&amp;nbsp; NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;10 444444444 30AUG2010 Personal Loan 32&amp;nbsp;&amp;nbsp; NPNA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;70 666666666 07FEB2010 Personal OD&amp;nbsp;&amp;nbsp; 999&amp;nbsp; Current&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;70 666666666 15MAR2010 Personal OD&amp;nbsp;&amp;nbsp; 666&amp;nbsp; Current&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;40 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 08FEB2010 Res. Mortgage 1877 Current&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;40 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 28MAR2010 Res. Mortgage 905&amp;nbsp; Current&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 11pt;"&gt;80 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 01FEB2010 Personal Loan 3000 90 +&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Mirisae&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Sep 2012 18:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80888#M17417</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-09-30T18:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help to convert this hard coding to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80889#M17418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wasn't sure of how to calculate "Balance %" (percent of which total?) but else below code should do what you asked for. You might want to give the datasets different names now that everything is done in one go.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data RAW_DATA_SET_3;&lt;BR /&gt;&amp;nbsp; inFormat Current_date date9.;&lt;BR /&gt;&amp;nbsp; input Bank_number Account_number $ 4-12 Current_date Product $ 24-36 Balance Arrears_Band $43-49;&lt;BR /&gt;&amp;nbsp; format Current_date date9.;&lt;BR /&gt;&amp;nbsp; cards;&lt;BR /&gt;10 1111111&amp;nbsp;&amp;nbsp; 31MAR2010 Personal Loan 555&amp;nbsp; 30 - 60&lt;BR /&gt;10 1111111&amp;nbsp;&amp;nbsp; 30APR2010 Personal Loan 200&amp;nbsp; Current&lt;BR /&gt;10 1111111&amp;nbsp;&amp;nbsp; 31MAY2010 Personal Loan 108&amp;nbsp; 1 - 30&lt;BR /&gt;30 1111111&amp;nbsp;&amp;nbsp; 31DEC2010 Res. Mortgage 800&amp;nbsp; Current&lt;BR /&gt;30 1111111&amp;nbsp;&amp;nbsp; 31JAN2011 Res. Mortgage 600&amp;nbsp; 90 +&lt;BR /&gt;30 1111111&amp;nbsp;&amp;nbsp; 28FEB2011 Res. Mortgage 600&amp;nbsp; NPNA&lt;BR /&gt;30 1111111&amp;nbsp;&amp;nbsp; 17MAR2011 Res. Mortgage 600&amp;nbsp; writoff&lt;BR /&gt;20 333333333 15MAR2010 Personal OD&amp;nbsp;&amp;nbsp; 700&amp;nbsp; NPNA&lt;BR /&gt;20 333333333 30APR2010 Personal OD&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;20 333333333 31MAY2010 Personal OD&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;20 333333333 30JUN2010 Personal OD&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;10 444444444 28FEB2010 Personal Loan 900&amp;nbsp; 1 - 30&lt;BR /&gt;10 444444444 31MAR2010 Personal Loan 800&amp;nbsp; 60 - 90&lt;BR /&gt;10 444444444 31MAY2010 Personal Loan 20&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;10 444444444 01JUL2010 Personal Loan 25&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;10 444444444 30AUG2010 Personal Loan 32&amp;nbsp;&amp;nbsp; NPNA&lt;BR /&gt;70 666666666 07FEB2010 Personal OD&amp;nbsp;&amp;nbsp; 999&amp;nbsp; Current&lt;BR /&gt;70 666666666 15MAR2010 Personal OD&amp;nbsp;&amp;nbsp; 666&amp;nbsp; Current&lt;BR /&gt;40 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 08FEB2010 Res. Mortgage 1877 Current&lt;BR /&gt;40 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 28MAR2010 Res. Mortgage 905&amp;nbsp; Current&lt;BR /&gt;80 777777&amp;nbsp;&amp;nbsp;&amp;nbsp; 01FEB2010 Personal Loan 3000 90 +&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* create format for date cycle */&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create view v_cyclefmt as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Cycle2Month' as fmtname&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,'n' as type&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,current_date as start&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,catx(' ',put(intnx('month',current_date,-1,'b'),monname.),put(intnx('month',current_date,-1,'b'),year4.),'to',put(current_date,monname.)) as label&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from RAW_DATA_SET_3&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format cntlin=v_cyclefmt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* create format for sort order of Arrears_Band&amp;nbsp; */&lt;BR /&gt;proc format ;&lt;BR /&gt;&amp;nbsp; invalue ArrearsCode &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'CURRENT' =1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '1-30'&amp;nbsp;&amp;nbsp;&amp;nbsp; =2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '30-60'&amp;nbsp;&amp;nbsp; =3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '60-90'&amp;nbsp;&amp;nbsp; =4&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '90+'&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =5&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'NPNA'&amp;nbsp;&amp;nbsp;&amp;nbsp; =6&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'WRITOFF' =7&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OTHER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =99&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; value ArrearsText &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1='Current'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2='1 - 30'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3='30 - 60'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4='60 - 90'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5='90 +' &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6='NPNA'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7='writoff'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 99='misscoded!'&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Sorting*/&lt;BR /&gt;proc sort data= RAW_DATA_SET_3 out=RAW_DATA_SET_3_sorted;&lt;BR /&gt;&amp;nbsp; by bank_number account_number current_date;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data Cycle_FEB_TO_MAR_2010_iso_;&lt;BR /&gt;&amp;nbsp; set RAW_DATA_SET_3_sorted;&lt;BR /&gt;&amp;nbsp; by bank_number account_number current_date;&lt;BR /&gt;&amp;nbsp; Arrears_Band_CD=input(upcase(compress(Arrears_Band)),ArrearsCode.);&lt;BR /&gt;&amp;nbsp; prior_Arrears_Band_CD = lag( Arrears_Band_CD );&lt;BR /&gt;&amp;nbsp; if intck('month',lag(current_date),current_date) ne 1 then call missing(prior_Arrears_Band_CD);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.account_number or missing(prior_Arrears_Band_CD) then delete;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options missing=' ';&lt;BR /&gt;proc tabulate data= Cycle_FEB_TO_MAR_2010_iso_ order=formatted;&lt;BR /&gt;&amp;nbsp; format current_date Cycle2Month. Arrears_Band_CD prior_Arrears_Band_CD ArrearsText.;&lt;BR /&gt;&amp;nbsp; label current_date='Cycle';&lt;BR /&gt;&amp;nbsp; class current_date / order=unformatted ;&lt;BR /&gt;&amp;nbsp; class prior_Arrears_Band_CD / order=unformatted;&lt;BR /&gt;&amp;nbsp; class Arrears_Band_CD / order=unformatted;&lt;BR /&gt;&amp;nbsp; var balance;&lt;BR /&gt;&amp;nbsp; table&amp;nbsp; current_date, prior_Arrears_Band_CD='', Arrears_Band_CD*(n balance*sum)/ box=prior_Arrears_Band_CD printmiss;&lt;BR /&gt;&amp;nbsp; Title 'Succession of O/S Balance ($ and %) and Accounts (#)';&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Oct 2012 01:18:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80889#M17418</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-10-01T01:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help to convert this hard coding to a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80890#M17419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Patrick,&lt;/P&gt;&lt;P&gt;This is a tremondous help as well as a very useful new knowledge for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much again!.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mirisage&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2012 00:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-convert-this-hard-coding-to-a-macro/m-p/80890#M17419</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-10-03T00:50:42Z</dc:date>
    </item>
  </channel>
</rss>

