<?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: Patterns in Audit Data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Patterns-in-Audit-Data/m-p/142073#M37851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think lags are actually the most elegant way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by ClientID DateAdd /*is there a Seqence Id for the ScreenCodes*/;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_3 = log3(ScreenCode);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_2 = log2(ScreenCode);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_1 = log1(ScreenCode);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.DateAdd then do; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_3 = '';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_2 = '';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_1 = '';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if ScreenCode eq 'CLOSSED' and Prev_ScreenCode_1 eq 'WITHDR'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and Prev_ScreenCode_2 eq 'ACC' and Prev_ScreenCode_3 eq 'ACC'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then output have;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are there other variables that need to be considered?&amp;nbsp; Do you *need* the pattern as 4 rows?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Dec 2014 07:27:08 GMT</pubDate>
    <dc:creator>DaveBirch</dc:creator>
    <dc:date>2014-12-09T07:27:08Z</dc:date>
    <item>
      <title>Patterns in Audit Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Patterns-in-Audit-Data/m-p/142072#M37850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to identify audit actions where only a pattern of actions occurred (all other actions discarded). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data is sorted by ClientID and DateAdd and there is a screen code for each line (Scr_Code). I need to pull out only cases where the order of screen codes goes ACC, ACC, WITHDR, CLOSSED&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a screen dump of an example with the pattern highlighted - I would only want this pattern returned, nothing else&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know it probably could be done with multiple lags but is there a more elegant way? The table holds millions of records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many, many thanks in advance.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10990iAC29E76E012DCC01/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="example.jpg" title="example.jpg" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2014 02:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Patterns-in-Audit-Data/m-p/142072#M37850</guid>
      <dc:creator>SteveNZ</dc:creator>
      <dc:date>2014-12-09T02:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Patterns in Audit Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Patterns-in-Audit-Data/m-p/142073#M37851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think lags are actually the most elegant way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by ClientID DateAdd /*is there a Seqence Id for the ScreenCodes*/;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_3 = log3(ScreenCode);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_2 = log2(ScreenCode);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_1 = log1(ScreenCode);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if first.DateAdd then do; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_3 = '';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_2 = '';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Prev_ScreenCode_1 = '';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if ScreenCode eq 'CLOSSED' and Prev_ScreenCode_1 eq 'WITHDR'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and Prev_ScreenCode_2 eq 'ACC' and Prev_ScreenCode_3 eq 'ACC'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then output have;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are there other variables that need to be considered?&amp;nbsp; Do you *need* the pattern as 4 rows?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2014 07:27:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Patterns-in-Audit-Data/m-p/142073#M37851</guid>
      <dc:creator>DaveBirch</dc:creator>
      <dc:date>2014-12-09T07:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Patterns in Audit Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Patterns-in-Audit-Data/m-p/142074#M37852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dave,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Worked a treat and yes there was a sequence id which I ended up using. I never realised you could put a number beside the lag to do it in one step - I thought it was going to be a nightmare of many lags!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your help, really appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2014 19:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Patterns-in-Audit-Data/m-p/142074#M37852</guid>
      <dc:creator>SteveNZ</dc:creator>
      <dc:date>2014-12-09T19:04:18Z</dc:date>
    </item>
  </channel>
</rss>

