<?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: Summay a binary flag field in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137421#M36991</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;BR /&gt;input var $ 19.;&lt;BR /&gt;datalines;&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;1&lt;BR /&gt;1&lt;BR /&gt;0&lt;BR /&gt;1&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want(keep=cnt_one);&lt;BR /&gt;set have end=eof;&lt;BR /&gt;if strip(var)='1' then cnt_one+1;&lt;BR /&gt;if eof then output;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Oct 2014 15:23:32 GMT</pubDate>
    <dc:creator>stat_sas</dc:creator>
    <dc:date>2014-10-22T15:23:32Z</dc:date>
    <item>
      <title>Summay a binary flag field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137420#M36990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quick question:&amp;nbsp; I have a 19 byte character field that contains only '0's and '1's.&amp;nbsp;&amp;nbsp; Is there a quick (simple) way to sum the numerals in the field&lt;/P&gt;&lt;P&gt;to see how many of them are set to '1'.&amp;nbsp; This way if the sum is &amp;gt; 1 I know there is more than 1 byte not 'zero'.&amp;nbsp; Unfortunately, the field is a&lt;/P&gt;&lt;P&gt;character field and I can't change that.&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>Wed, 22 Oct 2014 15:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137420#M36990</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2014-10-22T15:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Summay a binary flag field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137421#M36991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;BR /&gt;input var $ 19.;&lt;BR /&gt;datalines;&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;1&lt;BR /&gt;1&lt;BR /&gt;0&lt;BR /&gt;1&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want(keep=cnt_one);&lt;BR /&gt;set have end=eof;&lt;BR /&gt;if strip(var)='1' then cnt_one+1;&lt;BR /&gt;if eof then output;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2014 15:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137421#M36991</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-10-22T15:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Summay a binary flag field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137422#M36992</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;The data is in a variable formatted like:&amp;nbsp; '0001001000110001000'&amp;nbsp;&amp;nbsp; and I basically need to count the number of '1's.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could use an array but that is messy.&amp;nbsp; Hoping for something simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2014 15:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137422#M36992</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2014-10-22T15:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Summay a binary flag field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137423#M36993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ones = count(stringvar,'1');&lt;/P&gt;&lt;P&gt;should do it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2014 15:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137423#M36993</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-22T15:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Summay a binary flag field</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137424#M36994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bingo - I knew there would be something simple!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Oct 2014 15:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summay-a-binary-flag-field/m-p/137424#M36994</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2014-10-22T15:47:43Z</dc:date>
    </item>
  </channel>
</rss>

