<?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 Transpose and Count (?) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628627#M185786</link>
    <description>&lt;P&gt;Hi All:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data that is like this:&lt;/P&gt;&lt;TABLE border="1" cellspacing="5" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ColumnA&lt;/TD&gt;&lt;TD&gt;ColumnB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;@1email&lt;/TD&gt;&lt;TD&gt;1232;0829&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;@2email&lt;/TD&gt;&lt;TD&gt;1232;0829;0938&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;@1email&lt;/TD&gt;&lt;TD&gt;0938;48294;2938&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;@4email&lt;/TD&gt;&lt;TD&gt;0829;0938;0384&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my goal is to get this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically the count of column B each number before the ; - how many times they showed up&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" cellspacing="5" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ColumnA&lt;/TD&gt;&lt;TD&gt;ColumnB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1232&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0829&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0938&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;48294&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2938&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0384&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Mon, 02 Mar 2020 01:17:11 GMT</pubDate>
    <dc:creator>sasquest_J</dc:creator>
    <dc:date>2020-03-02T01:17:11Z</dc:date>
    <item>
      <title>Transpose and Count (?)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628627#M185786</link>
      <description>&lt;P&gt;Hi All:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data that is like this:&lt;/P&gt;&lt;TABLE border="1" cellspacing="5" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ColumnA&lt;/TD&gt;&lt;TD&gt;ColumnB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;@1email&lt;/TD&gt;&lt;TD&gt;1232;0829&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;@2email&lt;/TD&gt;&lt;TD&gt;1232;0829;0938&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;@1email&lt;/TD&gt;&lt;TD&gt;0938;48294;2938&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;@4email&lt;/TD&gt;&lt;TD&gt;0829;0938;0384&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my goal is to get this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically the count of column B each number before the ; - how many times they showed up&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" cellspacing="5" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ColumnA&lt;/TD&gt;&lt;TD&gt;ColumnB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1232&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0829&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0938&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;48294&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2938&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0384&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 02 Mar 2020 01:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628627#M185786</guid>
      <dc:creator>sasquest_J</dc:creator>
      <dc:date>2020-03-02T01:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose and Count (?)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628628#M185787</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input (ColumnA	ColumnB	) (:$20.);
cards4;
@1email	1232;0829
@2email	1232;0829;0938
@1email	0938;48294;2938
@4email	0829;0938;0384
;;;;

data temp;
set have;
do _n_=1 to countw(columnb,';');
 v=scan(columnb,_n_,';');
 output;
end;
keep v;
run;

proc freq data=temp ;
tables v/out=want(keep=v count);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Mar 2020 01:26:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628628#M185787</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-02T01:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose and Count (?)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628629#M185788</link>
      <description>&lt;P&gt;It would help if your outputs corresponded to the inputs. Or if you explained how the outputs are derived from the inputs, that would also help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As it is, I don't see how your fourth line of input corresponds to anything in the output, and then there are two extra lines of output that don't correspond to the inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So please explain, and provide examples of input data and desired output consistent with the explanation.&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 Mar 2020 01:28:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628629#M185788</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-02T01:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose and Count (?)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628632#M185790</link>
      <description>&lt;P&gt;Something fancy&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input (ColumnA	ColumnB	) (:$20.);
cards4;
@1email	1232;0829
@2email	1232;0829;0938
@1email	0938;48294;2938
@4email	0829;0938;0384
;;;;

data _null_;
 if _n_=1 then do;
   dcl hash H () ;
   h.definekey  ("v") ;
   h.definedata ("v","count") ;
   h.definedone () ;
 end;
set have end=z;
do _n_=1 to countw(columnb,';');
 v=scan(columnb,_n_,';');
 if  h.find() ne 0 then count=1;
 else count=sum(count,1);
 h.replace();
end;
if z;
h.output(dataset:'want');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Mar 2020 01:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transpose-and-Count/m-p/628632#M185790</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-02T01:40:11Z</dc:date>
    </item>
  </channel>
</rss>

