<?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 Counting rows in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Counting-rows/m-p/35938#M8952</link>
    <description>This is a very stupid question for which i seem to have lost my code and forgotten the rest. if someone can help me great.&lt;BR /&gt;
To uniquely count rows in a data set with duplicate primary keys e.g. Three rows with data with the same primary key and i want to count them 1,2,3.</description>
    <pubDate>Mon, 04 Aug 2008 12:26:22 GMT</pubDate>
    <dc:creator>InfoGuru</dc:creator>
    <dc:date>2008-08-04T12:26:22Z</dc:date>
    <item>
      <title>Counting rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-rows/m-p/35938#M8952</link>
      <description>This is a very stupid question for which i seem to have lost my code and forgotten the rest. if someone can help me great.&lt;BR /&gt;
To uniquely count rows in a data set with duplicate primary keys e.g. Three rows with data with the same primary key and i want to count them 1,2,3.</description>
      <pubDate>Mon, 04 Aug 2008 12:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-rows/m-p/35938#M8952</guid>
      <dc:creator>InfoGuru</dc:creator>
      <dc:date>2008-08-04T12:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Counting rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-rows/m-p/35939#M8953</link>
      <description>DATA step logic (sorted input file) using a BY statement and IF FIRST._varname_ logic to increment a user SAS variable for all non-FIRST conditions and assign a value of 1 for the FIRST condition.&lt;BR /&gt;
&lt;BR /&gt;
* input to next DATA step is sorted on _primary_key_variables_. ;&lt;BR /&gt;
DATA _output2_;&lt;BR /&gt;
set _input1_;&lt;BR /&gt;
BY _primary_key_variables_;&lt;BR /&gt;
IF FIRST._your_last_break_variable_ THEN DUPCOUNT = 0;&lt;BR /&gt;
IF NOT (FIRST._your_last_break_variable_ AND LAST._your_last_break_variable_) THEN DUPCOUNT + 1;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 04 Aug 2008 15:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-rows/m-p/35939#M8953</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-08-04T15:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Counting rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Counting-rows/m-p/35940#M8954</link>
      <description>Another method that may work if you just want the counts of each duplicate key tuple is to use PROC FREQ with the LIST option.</description>
      <pubDate>Tue, 05 Aug 2008 18:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Counting-rows/m-p/35940#M8954</guid>
      <dc:creator>mftuchman</dc:creator>
      <dc:date>2008-08-05T18:13:30Z</dc:date>
    </item>
  </channel>
</rss>

