<?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: counting observations in by group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273661#M54550</link>
    <description>Hi Astounding,&lt;BR /&gt;Thanks for your reply. Your code is working, but I want to put that 2 count in between other character variable. Like:&lt;BR /&gt;&lt;BR /&gt;Line='ABCD'||'M4U'||count1count2||'AAAAAA';&lt;BR /&gt;&lt;BR /&gt;Expected Output: ABCDM4U004006AAAAAA&lt;BR /&gt;&lt;BR /&gt;Can you please tell me how it is possible. Thanks.</description>
    <pubDate>Fri, 27 May 2016 17:40:47 GMT</pubDate>
    <dc:creator>mlogan</dc:creator>
    <dc:date>2016-05-27T17:40:47Z</dc:date>
    <item>
      <title>counting observations in by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273464#M54492</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;want to know how many times a by group occured in a table and write that on a separate dataset (has to be a character number as I am concatenating with character as well). Can someone help please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input Student_ID $ Course_ID $ Score;&lt;BR /&gt;cards; &lt;BR /&gt;M101 Eng 20&lt;BR /&gt;M101 Bio 20&lt;BR /&gt;M101 Eng 10&lt;BR /&gt;M101 Math 18&lt;BR /&gt;F103 Bio 18&lt;BR /&gt;F103 Math 99&lt;BR /&gt;F103 Eng 16&lt;BR /&gt;F103 Che 15&lt;BR /&gt;F103 Math 20&lt;BR /&gt;F103 Phy 17&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA want;&lt;BR /&gt;line='Totalcount'||Number of M101 by group occurance in have table||Number of F103 by group occurance in have table;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected output:&lt;/P&gt;
&lt;P&gt;line=Totalcount004006;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 02:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273464#M54492</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2016-05-27T02:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: counting observations in by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273466#M54493</link>
      <description>&lt;P&gt;Probably many ways to skin this cat ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;length line $ 16;&lt;/P&gt;
&lt;P&gt;retain line 'Totalcount';&lt;/P&gt;
&lt;P&gt;count=0;&lt;/P&gt;
&lt;P&gt;do until (last.Student_ID);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set have end=done;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;by Student_ID;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;count + 1;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;line = cats(line, put(count, z3.));&lt;/P&gt;
&lt;P&gt;keep line;&lt;/P&gt;
&lt;P&gt;if done;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's untested, but definitely headed in the right direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure you don't want to keep Student_ID as part of the output line?&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 02:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273466#M54493</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-27T02:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: counting observations in by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273470#M54497</link>
      <description>&lt;P&gt;That doesn't make sense, how would you parse the numbers back out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wouldn't you at least want a delimiter between the counts? Or a standard format, ie 8 digits?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you assuming the Z3 format, so no counts greater than 999?&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 02:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273470#M54497</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-27T02:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: counting observations in by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273596#M54535</link>
      <description>&lt;P&gt;What happens if you have more than two values for student_id such as M101 M102 M103 F101 F102 and F103?&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 14:46:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273596#M54535</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-27T14:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: counting observations in by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273661#M54550</link>
      <description>Hi Astounding,&lt;BR /&gt;Thanks for your reply. Your code is working, but I want to put that 2 count in between other character variable. Like:&lt;BR /&gt;&lt;BR /&gt;Line='ABCD'||'M4U'||count1count2||'AAAAAA';&lt;BR /&gt;&lt;BR /&gt;Expected Output: ABCDM4U004006AAAAAA&lt;BR /&gt;&lt;BR /&gt;Can you please tell me how it is possible. Thanks.</description>
      <pubDate>Fri, 27 May 2016 17:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/counting-observations-in-by-group/m-p/273661#M54550</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2016-05-27T17:40:47Z</dc:date>
    </item>
  </channel>
</rss>

