<?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: Controlling a first. counter with multiple &amp;quot;by&amp;quot; variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Controlling-a-first-counter-with-multiple-quot-by-quot-variables/m-p/393076#M277800</link>
    <description>&lt;P&gt;First, get a non macro solution working.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, post some example data please that illustrates your issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's sometimes hard to follow the logic in words, and sometimes the correct terms aren't used but having the data makes that easier to determine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to use IF first.C directly as far as I can tell, so not sure what B has to do with it, but an example will clarify that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're uncertain you can also review the examples in the BY group processing in the documentation.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Sep 2017 01:00:11 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-09-05T01:00:11Z</dc:date>
    <item>
      <title>Controlling a first. counter with multiple "by" variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-a-first-counter-with-multiple-quot-by-quot-variables/m-p/393072#M277799</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to&amp;nbsp;implement a series of flags (I would also be happy using counters instead) (via a macro) to flag (count) unique occurrences of variables. The data must&amp;nbsp;be sorted by variables &lt;FONT color="#ff6600"&gt;&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;a&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt;, &lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;FONT color="#ff6600"&gt;b&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt; and &lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;FONT color="#ff6600"&gt;c&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt; but I only want to increment the counter when a new instance of &lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;FONT color="#ff6600"&gt;c&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt; occurs within&amp;nbsp;each &lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;FONT color="#ff6600"&gt;a&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt;. Is that possible? (specifically, my problem is that the &lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;FONT color="#ff6600"&gt;c&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt; flag&amp;nbsp;= 1 every time I encounter a new &lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;FONT color="#ff6600"&gt;b&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt;, which I don't want).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose I could create a new sort variable that concatenates &lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;FONT color="#ff6600"&gt;a&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt; and &lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;FONT color="#ff6600"&gt;b&lt;FONT color="#3366ff"&gt;'&lt;/FONT&gt;&lt;/FONT&gt;, but I was hoping there was a more elegant solution?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#400080" face="Consolas"&gt;data &amp;amp;&lt;/FONT&gt;&lt;FONT color="#404000" face="Consolas"&gt;dataset.&lt;/FONT&gt;&lt;FONT color="#400080" face="Consolas"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#400080" face="Consolas"&gt;&amp;nbsp;&amp;nbsp;set &amp;amp;&lt;/FONT&gt;&lt;FONT color="#404000" face="Consolas"&gt;dataset.&lt;/FONT&gt;&lt;FONT color="#400080" face="Consolas"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#400080" face="Consolas"&gt;&amp;nbsp; by a b&amp;nbsp;&amp;amp;&lt;/FONT&gt;&lt;FONT color="#404000" face="Consolas"&gt;c.&lt;/FONT&gt; &lt;FONT color="#400080" face="Consolas"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#400080" face="Consolas"&gt;&amp;nbsp; if &lt;/FONT&gt;&lt;FONT color="#404000" face="Consolas"&gt;last.&lt;/FONT&gt;&lt;FONT color="#400080" face="Consolas"&gt;&amp;amp;&lt;/FONT&gt;&lt;FONT color="#404000" face="Consolas"&gt;c.&lt;/FONT&gt;&lt;FONT color="#400080" face="Consolas"&gt; then &amp;amp;c._flag = &lt;/FONT&gt;&lt;FONT color="#804040" face="Consolas"&gt;1&lt;/FONT&gt;&lt;FONT color="#400080" face="Consolas"&gt;; else &amp;amp;c._flag = &lt;/FONT&gt;&lt;FONT color="#804040" face="Consolas"&gt;0&lt;/FONT&gt;&lt;FONT color="#400080" face="Consolas"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 00:32:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-a-first-counter-with-multiple-quot-by-quot-variables/m-p/393072#M277799</guid>
      <dc:creator>Riccardo</dc:creator>
      <dc:date>2017-09-05T00:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling a first. counter with multiple "by" variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-a-first-counter-with-multiple-quot-by-quot-variables/m-p/393076#M277800</link>
      <description>&lt;P&gt;First, get a non macro solution working.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, post some example data please that illustrates your issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's sometimes hard to follow the logic in words, and sometimes the correct terms aren't used but having the data makes that easier to determine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to use IF first.C directly as far as I can tell, so not sure what B has to do with it, but an example will clarify that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're uncertain you can also review the examples in the BY group processing in the documentation.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 01:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-a-first-counter-with-multiple-quot-by-quot-variables/m-p/393076#M277800</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-05T01:00:11Z</dc:date>
    </item>
  </channel>
</rss>

