<?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: divide data into components and count new columns in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/557469#M9992</link>
    <description>&lt;P&gt;Thanks. The above works if some simple logic is added.&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ones = mod(x,10);&lt;/PRE&gt;&lt;P&gt;if ones&amp;lt;1 then ones= 0;&lt;BR /&gt;else ones= 1;&lt;/P&gt;</description>
    <pubDate>Thu, 09 May 2019 15:00:00 GMT</pubDate>
    <dc:creator>capam</dc:creator>
    <dc:date>2019-05-09T15:00:00Z</dc:date>
    <item>
      <title>divide data into components and count new columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/553431#M9378</link>
      <description>&lt;P&gt;I use Innov 9.4.&lt;/P&gt;&lt;P&gt;From a given table some of the data appears as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;How do I design an algorithm that outputs the following:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;slot 5&lt;/TD&gt;&lt;TD&gt;slot4&lt;/TD&gt;&lt;TD&gt;slot3&lt;/TD&gt;&lt;TD&gt;slot2&lt;/TD&gt;&lt;TD&gt;slot1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above is a simple count of each of the binary slots.&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 20:59:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/553431#M9378</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2019-04-23T20:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: divide data into components and count new columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/553438#M9380</link>
      <description>&lt;P&gt;It's not clear to me how you get the results. Explain in more detail. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 21:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/553438#M9380</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-23T21:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: divide data into components and count new columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/553443#M9381</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/154084"&gt;@capam&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x;
cards;
1
10
11
1
100
1000
10100
1000
1000
;

%let n=5;

data want(keep=s:);
retain slot&amp;amp;n-slot1;
array slot[&amp;amp;n];
do until(last);
  set have end=last;
  c=put(x,&amp;amp;n..);
  do i=1 to &amp;amp;n;
    slot[i]+(char(c,i)='1');
  end;
end;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Apr 2019 21:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/553443#M9381</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-04-23T21:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: divide data into components and count new columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/553444#M9382</link>
      <description>&lt;P&gt;This pulls those values apart:&lt;/P&gt;
&lt;PRE&gt;data junk;
   input x;
   ones = mod(x,10);
   tens = mod(int(x/10),10);
   hunds = mod(int(x/100),10);
   thous = mod(int(x/1000),10);
   tenthous = mod(int(x/10000),10);
datalines;
1 
10 
11 
1 
100 
1000 
10100 
1000 
1000 
;
run;&lt;/PRE&gt;
&lt;P&gt;Since your example shows totals you would use any of the summary or report procedures such as Means or summary, report or tabulate to get sums.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Slot? Really? And the order you named them makes little sense at all in relation to the positions. Though displaying the numeric value with a Z5. format might help.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 21:48:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/553444#M9382</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-23T21:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: divide data into components and count new columns</title>
      <link>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/557469#M9992</link>
      <description>&lt;P&gt;Thanks. The above works if some simple logic is added.&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ones = mod(x,10);&lt;/PRE&gt;&lt;P&gt;if ones&amp;lt;1 then ones= 0;&lt;BR /&gt;else ones= 1;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 15:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/divide-data-into-components-and-count-new-columns/m-p/557469#M9992</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2019-05-09T15:00:00Z</dc:date>
    </item>
  </channel>
</rss>

