<?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 the multiple accounts query in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-multiple-accounts-query/m-p/841912#M36502</link>
    <description>&lt;P&gt;SQL approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
  select
    debt_code,
    icustomerid,
    count(*) as count
  from have
  group by debt_code, icustomerid
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PROC FREQ method:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have nway;
class debt_code icustomerid;
var datekey;
output out=want n(datekey)=count;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested; for tested code, post data in usable form in a working data step with datalines.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Nov 2022 17:03:57 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-11-01T17:03:57Z</dc:date>
    <item>
      <title>Counting the multiple accounts query</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-multiple-accounts-query/m-p/841902#M36501</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a data set with debt_code, icustomerid, datekey and flag. I want to count the debt_code with unique datekey. This is to check how many times that debt_code has entered in same icustomerid. I am not sure how to write a code for it. I am looking to add a column which can show me how many times a particular debt_code has entered same icustomerid on different dates. For e,g,&amp;nbsp;266208776 has entered 21436 icustomerid 4 times on different dates (datekey). Can anyone assist what would be the best way to find it out?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Sample data. 
debt_code	icustomerid	datekey	flag
286338454	16418	   20220406	  0
295191266	16418	   20220406	  0
299889733	16418	   20220406	  0
266208776	21436	   20190207	  1
266208776	21436	   20190911	  1
266208776	21436	   20200109	  1
266208776	21436	   20201207	  1
291458610	21436	   20190911	  1
291458610	21436	   20190917	  1
291458610	21436	   20200109	  1
291458610	21436	   20201207	  1
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 16:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-multiple-accounts-query/m-p/841902#M36501</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2022-11-01T16:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Counting the multiple accounts query</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-the-multiple-accounts-query/m-p/841912#M36502</link>
      <description>&lt;P&gt;SQL approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
  select
    debt_code,
    icustomerid,
    count(*) as count
  from have
  group by debt_code, icustomerid
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PROC FREQ method:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have nway;
class debt_code icustomerid;
var datekey;
output out=want n(datekey)=count;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Untested; for tested code, post data in usable form in a working data step with datalines.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 17:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-the-multiple-accounts-query/m-p/841912#M36502</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-01T17:03:57Z</dc:date>
    </item>
  </channel>
</rss>

