<?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: Sas aml scenario in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448576#M112849</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I've asked you quite a few questions/had requests which you ignored so far. My MUST requests before I'm even looking at your code:&lt;/P&gt;
&lt;P&gt;1. Clear and full specification for the scenario you want to implement&lt;/P&gt;
&lt;P&gt;2. How do you plan to execute this scenario and in what frequency&lt;/P&gt;
&lt;P&gt;3. AML version this scenario will get executed under&lt;/P&gt;</description>
    <pubDate>Mon, 26 Mar 2018 09:07:29 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2018-03-26T09:07:29Z</dc:date>
    <item>
      <title>Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446369#M111983</link>
      <description>Hi&lt;BR /&gt;I have 6month transaction data&lt;BR /&gt;I want to get sum of currency amount on each month wise is greater than some value&lt;BR /&gt;If condition meets I need count on month wise&lt;BR /&gt;&lt;BR /&gt;Please help with code</description>
      <pubDate>Fri, 16 Mar 2018 22:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446369#M111983</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-16T22:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446370#M111984</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Getting-Started/How-to-get-fast-helpful-answers/ta-p/226133" target="_blank"&gt;https://communities.sas.com/t5/Getting-Started/How-to-get-fast-helpful-answers/ta-p/226133&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 23:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446370#M111984</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-16T23:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446405#M111991</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt; wrote:&lt;BR /&gt;Hi&lt;BR /&gt;I have 6month transaction data&lt;BR /&gt;I want to get sum of currency amount on each month wise is greater than some value&lt;BR /&gt;If condition meets I need count on month wise&lt;BR /&gt;&lt;BR /&gt;Please help with code&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you want code you need to include:&lt;/P&gt;
&lt;P&gt;1. Sample data&lt;/P&gt;
&lt;P&gt;2. Example of calculation required using #1&lt;/P&gt;
&lt;P&gt;3. Preferably what you've tried as well so we can point out what you need to change.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Mar 2018 01:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446405#M111991</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-17T01:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446414#M111996</link>
      <description>Data&lt;BR /&gt;Datekey currencyamount ACCnum&lt;BR /&gt;16mar2018 1000 123&lt;BR /&gt;16mar2018 200 123&lt;BR /&gt;16mar2018 300 124&lt;BR /&gt;15mar 2018 500 125&lt;BR /&gt;15mar2018 400 126&lt;BR /&gt;,&lt;BR /&gt;,&lt;BR /&gt;,&lt;BR /&gt;,&lt;BR /&gt;,&lt;BR /&gt;upto Previous 6months&lt;BR /&gt;I need sum (curr_amoun)t is between 500 to 900 in one month(twice in 6&lt;BR /&gt;months)&lt;BR /&gt;&lt;BR /&gt;Now this is my code&lt;BR /&gt;Begindate=input(put(rundate-180+1,num_to_date.),8.);&lt;BR /&gt;Do i=n to 1 by -1 while(datekey {i}&amp;gt;=begindate)&lt;BR /&gt;if begindate period_date= input(put( rundate-30+1, num_to_date.),8.);&lt;BR /&gt;&lt;BR /&gt;Do i=n to 1 by -1 while(datekey {i}&amp;gt;=begindate)&lt;BR /&gt;if period_date&lt;BR /&gt;sum=0;&lt;BR /&gt;count=0;&lt;BR /&gt;sum=sum(sum,currencyamount{i});&lt;BR /&gt;if 500&amp;lt;900 then count+1;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;if count&amp;gt;=2 then alert;</description>
      <pubDate>Sat, 17 Mar 2018 04:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446414#M111996</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-17T04:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446415#M111997</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Are you trying to write a rule which works as part of the SAS AML solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In regards of sample data: What you should provide is a fully working SAS data step which creates sample data - AND the sample data should have sufficient records for the rule you're after to actually fire.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And for your rule: When it comes to transaction monitoring then you're normally looking at some thresholds or patterns within a rolling time window and not at month by month. Once you've provided us with useful sample data you might also want to clearly articulate the rule you're after.&amp;nbsp; ...and what's also important to provide&amp;nbsp;you with something useful: What volumes are you dealing with and how is your environment sized (especially how much memory do you have available)?&lt;/P&gt;</description>
      <pubDate>Sat, 17 Mar 2018 07:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446415#M111997</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-17T07:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446420#M111998</link>
      <description>&lt;DIV&gt;Thanks for your reply.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data sample;&lt;/DIV&gt;&lt;DIV&gt;infile datalines;&lt;/DIV&gt;&lt;DIV&gt;input date_key date9. currency_amount&amp;nbsp; account_number;&lt;/DIV&gt;&lt;DIV&gt;datalines;&lt;/DIV&gt;&lt;DIV&gt;17mar2018&amp;nbsp; &amp;nbsp; 1000&amp;nbsp; &amp;nbsp; &amp;nbsp; 111&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;17mar2018&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2000&amp;nbsp; &amp;nbsp; &amp;nbsp;111&lt;/DIV&gt;&lt;DIV&gt;16mar2018&amp;nbsp; &amp;nbsp; &amp;nbsp;1200&amp;nbsp; &amp;nbsp; &amp;nbsp;111&lt;/DIV&gt;&lt;DIV&gt;15&amp;nbsp;&lt;SPAN&gt;mar&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;2018&amp;nbsp; &amp;nbsp; 1000&amp;nbsp; &amp;nbsp; 111&lt;BR /&gt;&lt;SPAN&gt;14&amp;nbsp;mar&amp;nbsp;2018&amp;nbsp; &amp;nbsp; 1500&amp;nbsp; &amp;nbsp; 111&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;13&amp;nbsp;mar&amp;nbsp;2018&amp;nbsp; &amp;nbsp; 1800&amp;nbsp; &amp;nbsp; 111&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;12&lt;SPAN&gt;mar&lt;/SPAN&gt;2018&amp;nbsp; &amp;nbsp; 1600&amp;nbsp; &amp;nbsp; 111&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;11&amp;nbsp;mar&amp;nbsp;2018&amp;nbsp; &amp;nbsp; &amp;nbsp;2200&amp;nbsp; &amp;nbsp;111&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;10&amp;nbsp;mar&amp;nbsp;2018&amp;nbsp; &amp;nbsp; &amp;nbsp;2200&amp;nbsp; &amp;nbsp;111&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;09&amp;nbsp;mar&amp;nbsp;2018&amp;nbsp; &amp;nbsp; &amp;nbsp;2200&amp;nbsp; &amp;nbsp;111&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;08&amp;nbsp;mar&amp;nbsp;2018&amp;nbsp; &amp;nbsp; &amp;nbsp;2200&amp;nbsp; &amp;nbsp;111&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;07&amp;nbsp;mar&amp;nbsp;2018&amp;nbsp; &amp;nbsp; &amp;nbsp;2200&amp;nbsp; &amp;nbsp;111&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;from above 10 days data&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;i want every 5 days total transaction amount is greaterthan 4000 and&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;if this kind of transaction occurs in 2 times in 10 days get alert&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sat, 17 Mar 2018 08:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/446420#M111998</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-17T08:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447700#M112520</link>
      <description>Hi Patrick&lt;BR /&gt;We have 15 lakh observations for one day.&lt;BR /&gt;Please reply on above question&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Mar 2018 09:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447700#M112520</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-22T09:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447703#M112522</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Does this need to be syntax which will be working within the SAS AML Solution....&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/software/products/aml/index.html" target="_blank"&gt;http://support.sas.com/software/products/aml/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;.... or is this unrelated to the SAS solution and you can do whatever you want?&lt;/P&gt;
&lt;P&gt;Please answer this question first as it's essential for how to address what you're after.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for your rule:&lt;/P&gt;
&lt;DIV&gt;&lt;EM&gt;"from above 10 days data&amp;nbsp;&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;i want every 5 days total transaction amount is greaterthan 4000 and&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;EM&gt;if this kind of transaction occurs in 2 times in 10 days get alert"&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Normally AML transaction monitoring rules are run at least daily (and some like credit cards real time) including all&amp;nbsp;transactions&amp;nbsp;for a&amp;nbsp;defined time period and eventually also including profile information from a much longer time period.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Given your rule as defined above and using your sample data, let's assume the first day we run the rule is &lt;EM&gt;06&amp;nbsp;mar&amp;nbsp;2018 &lt;/EM&gt;and on this day you've got a transaction of 5000, and then another transaction of 5000 on &lt;SPAN&gt;&lt;EM&gt;11&amp;nbsp;mar&amp;nbsp;2018:&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;1. On which dates would you expect your rule to fire?&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;2. Have you already considered how to deal with alerts who fire on multiple days based on the same transactions?&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;You really need to address these questions first before diving into coding.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Mar 2018 09:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447703#M112522</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-22T09:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447705#M112523</link>
      <description>It's just to understand data.&lt;BR /&gt;Not works in aml.</description>
      <pubDate>Thu, 22 Mar 2018 09:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447705#M112523</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-22T09:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447706#M112524</link>
      <description>I am trying to develop code to find sum of currency_amount over a period of&lt;BR /&gt;time.&lt;BR /&gt;&lt;BR /&gt;We have 13dec 2017 data only remain data not loaded.&lt;BR /&gt;This is Credit card project.&lt;BR /&gt;Tr</description>
      <pubDate>Thu, 22 Mar 2018 09:56:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447706#M112524</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-22T09:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447716#M112528</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;O.K: Using your sample data the following code creates a rolling sum over the last 5 days.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  infile datalines;
  input date_key :date9. currency_amount  account_number;
  format date_key date9.;
  datalines;
17mar2018 1000 111
17mar2018 2000 111
16mar2018 1200 111
15mar2018 1000 111
14mar2018 1500 111
13mar2018 1800 111
12mar2018 1600 111
11mar2018 2200 111
10mar2018 2200 111 
09mar2018 2200 111 
08mar2018 2200 111 
07mar2018 2200 111 
;
run;

proc sql;
  create table want as
      select 
        l.date_key,
        l.account_number,
        sum(r.currency_amount) as sum_curr_amt_5days
      from 
        (select distinct account_number, date_key from sample) as l inner join sample as r
      on l.account_number=r.account_number and r.date_key-l.date_key between -4 and 0
      group by l.account_number, l.date_key
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 306px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19377i731B24556B0A1F98/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now for your additional condition that the sum must exceed 5000 twice within some given periodicity:&lt;/P&gt;
&lt;P&gt;For which of the above dates would you expect the rule to fire?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 10:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447716#M112528</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-22T10:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447730#M112532</link>
      <description>&lt;P&gt;see Iam dealing with aml&amp;nbsp; project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have 1 month data starting from 13nov2017&amp;nbsp; to 13dec2017.Within this data i need to check&amp;nbsp; for&amp;nbsp;every 5 days&amp;nbsp;period of 30 days.&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;i have to find sum of currency amount&amp;nbsp; for every 5 days.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;if sum is greater than 100000 then get&amp;nbsp; &amp;nbsp;output.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;aml code iam attaching check once.&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;parameters

p013_agg_amount             =100000
p013_period_days            =5
p013_num_days               =30
p013_count            =2

p013_total_count = 0;
   p013_total_amount  = 0;
retain p013_T_begin_date;
retain p013_I_begin_date;
 p013_T_begin_date = input(put(rundate_number-&amp;amp;p013_num_days +1,num_to_date.),8.);

do i = n to 1 by -1 while (date_key{i} &amp;gt;=p013_T_begin_date);
  if  p013_T_begin_date &amp;lt;= date_key{i} &amp;lt;= rundate then do;
  
 p013_I_begin_date = input(put((rundate_number)-&amp;amp;p013_period_days+1,num_to_date.),8.);

	do j = n to 1 by -1 while (date_key{j} &amp;gt;=p013_I_begin_date);
		if  p013_I_begin_date &amp;lt;= date_key{j} &amp;lt;= rundate then do;
			if  upcase(account_type_desc{j}) in (&amp;amp;p013_account_type_desc) and 
       upcase(primary_medium_desc{j}) in (&amp;amp;p013_pri_medium_desc) and
       upcase(transaction_cdi_code{j}) in (&amp;amp;p013_cdi_indicator) and 
       upcase(status_desc{j}) in (&amp;amp; p013_status_desc)
    then do;
				%fcf_save_transaction_key (calling_macro=&amp;amp;this_macro_name);
				p013_total_amount = sum(p013_total_amount,currency_amount{j});
        /*p10006_total_count + 1; */
        /*repeat = indexw(p10006_day_list,kstrip(put(date_key{i},8.)));
        if repeat eq 0 and not missing(date_key{i}) then do;
            p10006_day_list = catx(' ',p10006_day_list,put(date_key{i},8.));
            p10006_day_count + 1;*/
        end;
    end;
	end;
	if p013_total_amount  &amp;gt;= &amp;amp;p013_agg_amount then do;
			 p013_total_count= sum( p013_total_count, 1);
	end;
  end;
end;

/* Compare party values to parameters for a match */
if p013_total_count  &amp;gt;=&amp;amp;p013_count then do;
    actual_values_text  =  tranwrd(&amp;amp;p013_threshold_message,'#1',kstrip(put(p013_total_count,nlnum32.)) );
    output &amp;amp;alert_fname;
end;

/* EXIT */
&amp;amp;sysmacroname.:;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 12:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/447730#M112532</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-22T12:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448027#M112647</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Now you've got me confused! First you write that what you're doing is unrelated to the SAS AML Solution but now you're telling me that it's actually related to the SAS AML Solution and you post SAS AML scenario code.&lt;/P&gt;
&lt;P&gt;The scenario code you've posted appears already to do what you're asking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sooo.... What is this now about? What problem are you trying to solve given that you've got already all the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just making assumptions here: If you're after code which simulates on which run dates the rule would have fired and using the sample data you've provided then below code should do the job.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  infile datalines;
  input date_key :date9. currency_amount  account_number;
  format date_key date9.;
  datalines;
21may2018 1000 111
20may2018 1000 111
19may2018 1000 111
15may2018 1000 111
25apr2018 1000 111
21apr2018 1000 111
20apr2018 9000 111
16apr2018 3000 111
15apr2018 1000 111
10apr2018 1000 111
05apr2018 1000 111
30mar2018 1000 111
23mar2018 1000 111
22mar2018 1000 111
19mar2018 1000 111
17mar2018 1000 111
17mar2018 2000 111
16mar2018 1200 111
15mar2018 1000 111
14mar2018 1500 111
13mar2018 1800 111
12mar2018 1600 111
11mar2018 2200 111
10mar2018 2200 111 
09mar2018 2200 111 
08mar2018 2200 111 
07mar2018 2200 111 
;
run;


%let p013_agg_amount =12000;
%let p013_period_days =5;
%let p013_num_days =30;
%let p013_count =2;

proc sql;
  create table rolling5days as
      select 
        l.date_key,
        l.account_number,
        sum(r.currency_amount) as sum_curr_amt_5days
      from 
        (select distinct account_number, date_key from sample) as l inner join sample as r
      on l.account_number=r.account_number and r.date_key-l.date_key between -(&amp;amp;p013_period_days+1) and 0
      group by l.account_number, l.date_key
      order by l.account_number, l.date_key;
  ;
quit;


data alert(drop=_:);
  set rolling5days end=last;
  by account_number date_key;

  array vals {0:%eval(&amp;amp;p013_num_days-1)} 8. _temporary_;
  _ldk=lag(date_key);

  if first.account_number then call missing(of vals[*], _ldk);
  else
    do _i=0 to dim(vals); 

      call missing(vals[mod(_ldk+1+_i,&amp;amp;p013_num_days)]);
      if mod(_ldk+1+_i,&amp;amp;p013_num_days) = mod(date_key,&amp;amp;p013_num_days) then leave;
    end;

  if sum_curr_amt_5days&amp;gt;=&amp;amp;p013_agg_amount then vals[mod(date_key,&amp;amp;p013_num_days)]=sum_curr_amt_5days;
  if n(of vals[*])&amp;gt;=&amp;amp;p013_count then output;

run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Mar 2018 03:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448027#M112647</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-23T03:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448408#M112788</link>
      <description>&lt;P&gt;hello patrick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Iam working&amp;nbsp;&amp;nbsp;in AML ENCVIRONMENT.&amp;nbsp; &amp;nbsp;I&amp;nbsp;need to do&amp;nbsp; &amp;nbsp; in datastep only .&lt;/P&gt;</description>
      <pubDate>Sat, 24 Mar 2018 09:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448408#M112788</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-24T09:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448431#M112797</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;I&amp;nbsp;need to do&amp;nbsp; &amp;nbsp; in datastep only&lt;/EM&gt; " Why?&lt;/P&gt;
&lt;P&gt;You also haven't explained me yet why you've first said that this has nothing to do with the SAS AML Solution and now "suddenly" it has everything to do with the SAS AML Solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't execute and really test it but the scenario code you've posted looks o.k. to me and should work within the SAS AML Solution.&lt;/P&gt;
&lt;P&gt;So what's the problem you want to solve? What are you trying to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We're now at the point where you need to provide quite a bit more and explicit information what you have and what you need.&lt;/P&gt;
&lt;P&gt;- Which AML version?&lt;/P&gt;
&lt;P&gt;- What type of header (post the code)?&lt;/P&gt;
&lt;P&gt;- Post a SAS data step which creates sample data which can serve as source for your header and scenario code (so with all the columns and the right values for columns used for selections)&lt;/P&gt;
&lt;P&gt;- Given that you've already&amp;nbsp;got working scenario code: What's the problem you're trying to solve?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You were at one point writing about "data not loaded". So in case you're trying to create alerts for "old" transactions within the AML Solution which haven't been monitored before ("backwash"): That's currently not possible!&amp;nbsp; - .,.I can be wrong but I believe I've heard that this is under consideration&amp;nbsp;for future AML releases....Won't be easy though as this has a lot of implications.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code I've posted will allow you to "simulate" the result (the dates with alerts) you would have got if executed against the transactions not loaded. The current version of the&amp;nbsp;SAS AML Solution doesn't allow you to backfill such alerts into the actual AML database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;....whatever answer you're going to give me: If it contains less characters than my post here then it's&amp;nbsp;not detailed enough. I won't continue guessing what you're after &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Mar 2018 15:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448431#M112797</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-24T15:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448480#M112819</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi I am facing a problem to develop a SAS programme in AML to find out sum of all transactions of an account holder in a single day and also to find out sum of all transactions of an account holder in 5 days.Please help me in this regard&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Mar 2018 06:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448480#M112819</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-25T06:51:14Z</dc:date>
    </item>
    <item>
      <title>Re:AML scenario_party_header</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448481#M112820</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*------*/
/* Test */
/*------*/
%let runasofdate = 20171213;

%let header_id = 2;

/* Set error code to 0 */
%let trans_rc = 0;

/* Include Scenario Messages */
filename scenMsgs "!AMLROOT/scenario/codegen/scenario_messages.sas" encoding='windows';
%include scenMsgs;

/* Set alert filenames */
%let alert_fname=work._tempalerts;
%let alert_fname_final=STG_ALER.PARTY_ALERTS&amp;amp;runasofdate ;

/* Set other variables related to storing transaction keys in a data set. */
%let alert_fname_trans_keys=work._tempalerts_trans_keys;
%let alert_fname_final_trans_keys=STG_ALER.trankey_&amp;amp;header_id._&amp;amp;runasofdate ;
%let alert_fname_temp=work._tempalerts2;

/* Macros for each scenario/risk factor */
/* SBIC010 */
%macro fcf_run_scenario_11790 (
    p010_curr_deposit_min=, 
    p010_credit_indicator=, 
    p010_ctr_amount_limit=, 
    p010_account_type_desc=, 
    p010_currency_acct=, 
    p010_structure_index=, 
    p010_num_days=, 
    p010_pri_medium_desc=, 
    p010_status_desc=, 
    p010_min_days= 
    );

    %include  '!AMLROOT/scenario/scenario_code_active/SBIC010.sas' ;
%mend;

/* End scenario/risk factor macros */

/* Set array_dimension value */
%fcf_calculate_array_dim(ds=MST_PREP.PARTY_TRANSACTIONS, nkey=PARTY_NUMBER);
%fcf_rcset(&amp;amp;syserr);

/* Begin Header Code */

data &amp;amp;alert_fname
     (drop=_transaction_key_)
     &amp;amp;alert_fname_trans_keys(keep=primary_entity_number scenario_id _transaction_key_)
     ;
   keep primary_entity_number scenario_id rundate actual_values_text entity_level_code
        _transaction_key_
        ;
   format rundate date9. actual_values_text $512. entity_level_code $3.;
   format primary_entity_number $ 75.;
    array DATE_KEY  (&amp;amp;array_dimension) _temporary_ ;
    array TRANSACTION_CDI_CODE  (&amp;amp;array_dimension) $1 _temporary_ ;
    array SECONDARY_MEDIUM_DESC  (&amp;amp;array_dimension) $20 _temporary_ ;
    array STATUS_DESC  (&amp;amp;array_dimension) $20 _temporary_ ;
    array ACCOUNT_NUMBER  (&amp;amp;array_dimension) $50 _temporary_ ;
    array ACCOUNT_TYPE_DESC  (&amp;amp;array_dimension) $20 _temporary_ ;
    array CURRENCY_BASED_ACCOUNT_IND  (&amp;amp;array_dimension) $1 _temporary_ ;
    array PRIMARY_MEDIUM_DESC  (&amp;amp;array_dimension) $20 _temporary_ ;
    array MECHANISM_DESC  (&amp;amp;array_dimension) $20 _temporary_ ;
    array COUNTRY_CODE_3  (&amp;amp;array_dimension) $3 _temporary_ ;
    array CURRENCY_CODE  (&amp;amp;array_dimension) $3 _temporary_ ;
    array CURRENCY_AMOUNT  (&amp;amp;array_dimension) _temporary_ ;
    array TRANSACTION_KEY  (&amp;amp;array_dimension) _temporary_ ;
    set MST_PREP.PARTY_TRANSACTIONS
        (rename=(
        DATE_KEY = temp1
        TRANSACTION_CDI_CODE = temp2
        SECONDARY_MEDIUM_DESC = temp3
        STATUS_DESC = temp4
        ACCOUNT_NUMBER = temp6
        ACCOUNT_TYPE_DESC = temp7
        CURRENCY_BASED_ACCOUNT_IND = temp8
        PRIMARY_MEDIUM_DESC = temp15
        MECHANISM_DESC = temp16
        COUNTRY_CODE_3 = temp17
        CURRENCY_CODE = temp18
        CURRENCY_AMOUNT = temp19
        TRANSACTION_KEY = temp20
        ))
        ;
        by PARTY_NUMBER ;
        if _n_ eq 1 then do;
          retain rundate rundate_number entity_level_code run_scenario_init;
          rundate = input(put(&amp;amp;runasofdate,8.),yymmdd8.);
          rundate_number = input(put(rundate,date_to_num.),8.);
          entity_level_code = "PTY";
          run_scenario_init = 1;
        end;
        if first.PARTY_NUMBER then n = 0;
        n + 1;
        if n le &amp;amp;array_dimension then do;
            DATE_KEY{n} = temp1;
            TRANSACTION_CDI_CODE{n} = temp2;
            SECONDARY_MEDIUM_DESC{n} = temp3;
            STATUS_DESC{n} = temp4;
            ACCOUNT_NUMBER{n} = temp6;
            ACCOUNT_TYPE_DESC{n} = temp7;
            CURRENCY_BASED_ACCOUNT_IND{n} = temp8;
            PRIMARY_MEDIUM_DESC{n} = temp15;
            MECHANISM_DESC{n} = temp16;
            COUNTRY_CODE_3{n} = temp17;
            CURRENCY_CODE{n} = temp18;
            CURRENCY_AMOUNT{n} = temp19;
            TRANSACTION_KEY{n} = temp20;
        end;
        if not last.PARTY_NUMBER then return;
        primary_entity_number = PARTY_NUMBER;

        /* End Header Code Generation */

        /* Call each scenario/risk factor macro after setting scenario_id variable.*/
        scenario_id = 11790;
        /* SBIC010 */
        %fcf_run_scenario_11790 (
            p010_curr_deposit_min=950000 ,
            p010_credit_indicator=%str('C') , 
            p010_ctr_amount_limit=999999999999 ,
            p010_account_type_desc=%str('P') , 
            p010_currency_acct=%str('N') , 
            p010_structure_index=20 ,
            p010_num_days=30 ,
            p010_pri_medium_desc=%str('FUND') , 
            p010_status_desc=%str('SUCCESS') , 
            p010_min_days=1 
        );

   run_scenario_init = 0;
   drop run_scenario_init;
 run;

%fcf_rcset(&amp;amp;syserr);

/*-------------------------------------------  
 * Determine if transaction keys were saved.   
 *-------------------------------------------*/
%macro fcf_process_transaction_keys;
 %global fcf_process_trans_keys;
 %let fcf_process_trans_keys = 0;
 %if %sysfunc(exist(&amp;amp;alert_fname_trans_keys)) %then %do;
   %let dsid = %sysfunc(open(&amp;amp;alert_fname_trans_keys));
   %if &amp;amp;dsid %then %do;
     %let fcf_process_trans_keys = %sysfunc(attrn(&amp;amp;dsid, nlobs));
     %let rc = %sysfunc(close(&amp;amp;dsid));
   %end;
 %end;

 %if &amp;amp;fcf_process_trans_keys gt 0 %then %do;
  /*-------------------------------------------------------  
   * Scenarios may save duplicate transaction keys.          
   * Remove duplicates since record of only one is needed.   
   *-------------------------------------------------------*/
  proc sort data=&amp;amp;alert_fname_trans_keys
             out=&amp;amp;alert_fname_trans_keys(rename=(_transaction_key_ = transaction_key))
       nodupkeys;
    by primary_entity_number scenario_id _transaction_key_;
   run;

  proc sort data=&amp;amp;alert_fname(keep=primary_entity_number scenario_id)
            out=&amp;amp;alert_fname_temp;
    by primary_entity_number scenario_id;
   run;

  /*-------------------------------------------------------------------------  
   * As criteria for an alert is met, scenarios save related transaction       
   * keys.  Later it may be determined that an alert should not be generated   
   * if additional criteria for the alert is not met, so the keys              
   * previously saved are no longer needed.  Here only transactions keys       
   * associated with generated alerts (all alert criteria met) are kept.       
   *-------------------------------------------------------------------------*/
  data &amp;amp;alert_fname_trans_keys;
   merge &amp;amp;alert_fname_temp(in=alertgen) &amp;amp;alert_fname_trans_keys(in=keys);
    by primary_entity_number scenario_id;
    if alertgen and keys;
   run;
 %end;  /*if fcf_process_trans_keys gt 0*/
%mend fcf_process_transaction_keys;
%fcf_process_transaction_keys;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Mar 2018 07:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448481#M112820</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-25T07:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448482#M112821</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You've got the header code (auto-generated header) and you've got scenario code already close to what you'll likely need.&lt;/P&gt;
&lt;P&gt;Do&amp;nbsp;you&amp;nbsp;understand how this code works or are you just&amp;nbsp;copy/pasting existing code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What&amp;nbsp;have you done so far and where do you get stuck?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're also changing your requirements. It was....&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;"I have 1 month data starting from 13nov2017&amp;nbsp; to 13dec2017.Within this data i need to check&amp;nbsp; for every 5 days period of 30 days &lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;i have to find sum of currency amount&amp;nbsp; for every 5 days&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;if sum is greater than 100000 then get&amp;nbsp;&amp;nbsp; output ."&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;at one point you needed at least 2 days over a limit&amp;nbsp;within 30 days...&lt;/P&gt;
&lt;P&gt;....and now it is:&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;sum of all transactions of an account holder in a single day and also to find out sum of all transactions of an account holder in 5&lt;/EM&gt; "&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First action: Clearly specify your requirement!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And to repeat:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;....whatever answer you're going to give me: If it contains less characters than my post here then it's not detailed enough. I won't continue guessing what you're after &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can help you with&amp;nbsp;this task&amp;nbsp;but I'm not going to do your work for you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Mar 2018 08:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448482#M112821</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-25T08:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448561#M112842</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Patrick,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;when I executed&amp;nbsp;this code it is producing sum of all transactions of an account holder in a day and also giving sum of all transactions minus first,second (it is substracting from top observation value to the bottom of that day) transaction of account holder .But I need only sum of all transactions in a day(that is greater than some value).&amp;nbsp; &amp;nbsp; please help me in this regard.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;for example&amp;nbsp; &amp;nbsp; 13/12/2017&amp;nbsp; &amp;nbsp;2000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;5000-2000 =3000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13/12/2017&amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3000-0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13/12/2017&amp;nbsp; &amp;nbsp;3000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3000-3000&amp;nbsp; 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;totalvalue&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if i write condition total value&amp;gt;3000&amp;nbsp; it is giving&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;13/12/2017&amp;nbsp; &amp;nbsp;2000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;5000-2000 =3000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;13/12/2017&amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2000-0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;we have three days data 13dec2017 to 15dec2017.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;period_ days=3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;%let this_macro_name = &amp;amp;sysmacroname;
array &amp;amp;sysmacroname.1 {&amp;amp;p013_period_days} _temporary_;
/* Empty the array */
do x = 1 to &amp;amp;p013_period_days;
   &amp;amp;sysmacroname.1{x} = 0;
end;

p013_total_count =0;
p013_total_amount=0;
p013_loop_check=0;
retain p013_begin_period_date;



  
p013_begin_period_date = input(put((rundate_number)-&amp;amp;p013_period_days+1,num_to_date.),8.);

                do i = n to 1 by -1 while ( date_key{i} &amp;gt;= p013_begin_period_date);
                                if p013_begin_period_date&amp;lt;= date_key{i}&amp;lt;=rundate  and
                        upcase(account_type_desc{i}) in (&amp;amp;p013_account_type_desc) and 
       upcase(primary_medium_desc{i}) in (&amp;amp;p013_pri_medium_desc) and
       upcase(transaction_cdi_code{i}) in (&amp;amp;p013_cdi_indicator) and 
       upcase(status_desc{i}) in (&amp;amp;p013_status_desc)
    then do;
p013_date_key_num = input(put(date_key{i},date_to_num.),8.);
      temp_date_key = date_key{i};
      do  while (p013_date_key_num = 0);
         temp_date_key = temp_date_key + 1;
         p013_date_key_num = input(put(temp_date_key,date_to_num.),8.);
      end;
      j = rundate_number - p013_date_key_num+1;
      &amp;amp;sysmacroname.1{j}=sum(&amp;amp;sysmacroname.1{j},currency_amount{i});
                  if (&amp;amp;sysmacroname.1{j}) &amp;gt;= &amp;amp;p013_agg_amount and j&amp;gt;1 then do;

if p013_loop_check = 1 then do j = 1 to &amp;amp;p013_period_days;
   if (&amp;amp;sysmacroname.1{j}) &amp;gt;= &amp;amp;p013_agg_amount and j&amp;gt;1 then do;
      p013_x = &amp;amp;sysmacroname.1{j};
      p013_y = 0;
      do k = 1 to &amp;amp;p013_period_days;
         if &amp;amp;sysmacroname.1{k} &amp;gt;= p013_x then p013_y = p013_y + 1;
         p013_z = k;
         if p013_y &amp;gt;= &amp;amp;p013_count then do;
                actual_values_text  =  tranwrd(&amp;amp;r10005_threshold_message,'#1',kstrip(put(&amp;amp;sysmacroname.1{j},nlnum32.)) );
    actual_values_text  =  tranwrd(actual_values_text,'#$', "&amp;amp;currency_code" );
    output &amp;amp;alert_fname;

end;
end;
end;
end;
end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 05:24:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448561#M112842</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-03-26T05:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sas aml scenario</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448576#M112849</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I've asked you quite a few questions/had requests which you ignored so far. My MUST requests before I'm even looking at your code:&lt;/P&gt;
&lt;P&gt;1. Clear and full specification for the scenario you want to implement&lt;/P&gt;
&lt;P&gt;2. How do you plan to execute this scenario and in what frequency&lt;/P&gt;
&lt;P&gt;3. AML version this scenario will get executed under&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 09:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sas-aml-scenario/m-p/448576#M112849</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-26T09:07:29Z</dc:date>
    </item>
  </channel>
</rss>

