<?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: How to counting based on number of time source origination in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629373#M20740</link>
    <description>&lt;P&gt;Why does A8/B1 have a count of 1, when there is no "parent" record for B1?&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 08:37:30 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-03-04T08:37:30Z</dc:date>
    <item>
      <title>How to counting based on number of time source origination</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629335#M20736</link>
      <description>&lt;P&gt;I have 2 column, column_A is origination, column B is source of origination, how to we have result in Column C&lt;/P&gt;&lt;P&gt;Examples: A7 - A5 is 1, A9 -- A7 is 2 due to A9 from A7 and A7 from A5, the same A10 -- A7 is 3 due to A10 from A9 and A9 from A7 and A7 from A5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column_A&amp;nbsp; &amp;nbsp; &amp;nbsp; Column_B&amp;nbsp; &amp;nbsp; Result_Column_C&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; A5&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;STRONG&gt; A7&amp;nbsp;&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;A5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; A8&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;STRONG&gt;A9&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;A7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; A10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 02:10:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629335#M20736</guid>
      <dc:creator>hoangtuyen90</dc:creator>
      <dc:date>2020-03-04T02:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to counting based on number of time source origination</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629373#M20740</link>
      <description>&lt;P&gt;Why does A8/B1 have a count of 1, when there is no "parent" record for B1?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 08:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629373#M20740</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-04T08:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to counting based on number of time source origination</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629375#M20741</link>
      <description>&lt;P&gt;If I insert an artificial "parent" obs for B1, this code works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines truncover;
input col_a $ col_b $;
datalines;
A5
A7 A5
A8 B1
A9 A7
A10 A9
B1
;

data want;
set have;
if _n_ = 1
then do;
  declare hash a (dataset:'have (keep=col_a)');
  a.definekey('col_a');
  a.definedone();
  declare hash b (dataset:'have');
  b.definekey('col_b');
  b.definedata('col_a');
  b.definedone();
end;
if a.find(key:col_b) ne 0; /* master parent */
col_c = .;
output;
col_c = 1;
col_b = col_a;
rc = b.find();
do while (rc = 0);
  output;
  col_c + 1;
  col_b = col_a;
  rc = b.find();
end;
drop rc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Mar 2020 08:43:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629375#M20741</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-04T08:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to counting based on number of time source origination</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629787#M20776</link>
      <description>&lt;P&gt;It’s just one to one match ?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 13:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-counting-based-on-number-of-time-source-origination/m-p/629787#M20776</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-03-05T13:57:59Z</dc:date>
    </item>
  </channel>
</rss>

