<?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: Creating a flag for the first time a value appears in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192298#M4025</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is monotonic available?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jan 2015 03:21:46 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-01-22T03:21:46Z</dc:date>
    <item>
      <title>Creating a flag for the first time a value appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192295#M4022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to DI and I am not sure if this has been answered elsewhere, but does anyone know how to create a flag or a counter for the first time a value appears for a dataset?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SAS BASE code, I use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data output;&lt;/P&gt;&lt;P&gt;set input;&lt;/P&gt;&lt;P&gt;by variable;&lt;/P&gt;&lt;P&gt;if first.variable then count = 1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this would be extremely helpful. If anything doesn't make sense let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 00:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192295#M4022</guid>
      <dc:creator>Shirki</dc:creator>
      <dc:date>2015-01-22T00:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a flag for the first time a value appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192296#M4023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe this is the right approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first sort the dataset on the variables in which you want the data to sort and then&amp;nbsp; use first.var to flag the record. Please let me know if this has not worked for you or provide a sample data . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 01:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192296#M4023</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-01-22T01:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a flag for the first time a value appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192297#M4024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jag,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the quick response. The approach I mentioned works in EG but I need a DI method that does the same thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have searched online and tried to use ROWNUMBER or ROWCOUNT but DI informs me that it cannot find those functions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Kimberley&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 02:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192297#M4024</guid>
      <dc:creator>Shirki</dc:creator>
      <dc:date>2015-01-22T02:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a flag for the first time a value appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192298#M4025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is monotonic available?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 03:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192298#M4025</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-22T03:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a flag for the first time a value appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192299#M4026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to use monotonic! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up using monotonic to create a row number and then using min() to get the lowest row number for my variable. Followed by applying a boolean value where 1 was the min row number and 0 was any succeeding row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 04:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192299#M4026</guid>
      <dc:creator>Shirki</dc:creator>
      <dc:date>2015-01-22T04:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a flag for the first time a value appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192300#M4027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a warning that it's considered unsupported and shouldn't be used in production - so use at your own risk &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 04:11:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192300#M4027</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-22T04:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a flag for the first time a value appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192301#M4028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the warning, I'll use it for testing and validation purposes but keep it out of my production jobs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the meantime, I'll keep hunting for a supported method :smileygrin:.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 04:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192301#M4028</guid>
      <dc:creator>Shirki</dc:creator>
      <dc:date>2015-01-22T04:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a flag for the first time a value appears</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192302#M4029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't use monotonic() interchangeable with first. processing of the data step. It' more like the _n_ variable.&lt;/P&gt;&lt;P&gt;But if it fits your current need, great.&lt;/P&gt;&lt;P&gt;To be able to use first. processing in DIS, you need to use User Written code, there is no "pure" data step transformation available.&lt;/P&gt;&lt;P&gt;About montonic() being unsupported, one funny thing is that is now being used within the Data Validation transformation. Wonder if SAS is supporting that... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jan 2015 23:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Creating-a-flag-for-the-first-time-a-value-appears/m-p/192302#M4029</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-01-22T23:04:18Z</dc:date>
    </item>
  </channel>
</rss>

