<?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: Loop comparing a hash value between dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-comparing-a-hash-value-between-dates/m-p/741416#M231767</link>
    <description>&lt;P&gt;I &lt;EM&gt;&lt;STRONG&gt;strongly&lt;/STRONG&gt;&lt;/EM&gt; suggest you make working code without using it in a macro - i.e. &lt;EM&gt;&lt;STRONG&gt;make a single iteration of your loop that works&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp;&amp;nbsp;Fill in constant values for a single iteration and debug it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the moment, if you removed all the macro-related parameters and variables, you would still have code that would generate error messages.&amp;nbsp; For instance you have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
    DATE_FROM = '05MAY2019'D;
    /* ... other code here ... */
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;Run this and you'll see that it fails.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 May 2021 12:52:23 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2021-05-14T12:52:23Z</dc:date>
    <item>
      <title>Loop comparing a hash value between dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-comparing-a-hash-value-between-dates/m-p/741331#M231725</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;I want to compare a hash value between some days and obtain a new table(s) with the results, just to known where the data has changed. The Second table has a day plus than the first table to make de evaluation and see if the next day has a different value. i'm not sure if i can do something like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro sqlloop(start,end);&lt;BR /&gt;PROC SQL;&lt;BR /&gt;DATE_FROM = '05MAY2019'D;&lt;BR /&gt;%DO ADD=&amp;amp;start. %TO &amp;amp;end.;&lt;BR /&gt;DATE_PLUS1=intnx('DAY',&amp;amp;DATE_FROM,1);&lt;BR /&gt;CREATE TABLE NewTable&amp;amp;ADD. as&lt;BR /&gt;SELECT t1.date, t1.account, t1.val_hash FROM table1 t1, table2 t2&lt;BR /&gt;WHERE t1.date = "&amp;amp;DATE_FROM"D AND t2.date = "&amp;amp;DATE_PLUS1"D&lt;BR /&gt;AND t1.account = t2.account&lt;BR /&gt;AND t1.VAL_HASH &amp;lt;&amp;gt; t2.VAL_HASH;&lt;BR /&gt;DATE_FROM=intnx('DAY',&amp;amp;DATE_FROM,1);&lt;BR /&gt;%END;&lt;BR /&gt;QUIT;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%sqlloop(start=1, end=10)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;table2 is a replicate of table1, just to make the comparisson between dates.&lt;BR /&gt;The val_hash column contains the data that i need to evaluate if it has changed.&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 01:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-comparing-a-hash-value-between-dates/m-p/741331#M231725</guid>
      <dc:creator>Jose7</dc:creator>
      <dc:date>2021-05-14T01:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Loop comparing a hash value between dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-comparing-a-hash-value-between-dates/m-p/741416#M231767</link>
      <description>&lt;P&gt;I &lt;EM&gt;&lt;STRONG&gt;strongly&lt;/STRONG&gt;&lt;/EM&gt; suggest you make working code without using it in a macro - i.e. &lt;EM&gt;&lt;STRONG&gt;make a single iteration of your loop that works&lt;/STRONG&gt;&lt;/EM&gt;.&amp;nbsp;&amp;nbsp;Fill in constant values for a single iteration and debug it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the moment, if you removed all the macro-related parameters and variables, you would still have code that would generate error messages.&amp;nbsp; For instance you have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
    DATE_FROM = '05MAY2019'D;
    /* ... other code here ... */
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;Run this and you'll see that it fails.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 12:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-comparing-a-hash-value-between-dates/m-p/741416#M231767</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-05-14T12:52:23Z</dc:date>
    </item>
  </channel>
</rss>

