<?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: Creating a new variable based on Count of 2 other variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-based-on-Count-of-2-other-variables/m-p/551981#M153434</link>
    <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
&amp;nbsp; select Report_Month,&amp;nbsp;count(unique&amp;nbsp;Custer_ID) as Count
&amp;nbsp; from&amp;nbsp;Sales_Details
&amp;nbsp; group by&amp;nbsp;Report_Month;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Apr 2019 03:49:19 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2019-04-18T03:49:19Z</dc:date>
    <item>
      <title>Creating a new variable based on Count of 2 other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-based-on-Count-of-2-other-variables/m-p/551960#M153422</link>
      <description>&lt;P&gt;Hi Everyone,&lt;BR /&gt;&lt;BR /&gt;I am looking to create a new variable that counts unique customers, based on the month - represented by Custer_ID and Report_Month respectively. Any help would be greatly appreciated!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Here is what I have so far - thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sales_summary1;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set Sales_Details;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Distinct_Customer = count(Customer_Id,Report_Month);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; keep Distinct_Customer report_month sales_channel;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 01:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-based-on-Count-of-2-other-variables/m-p/551960#M153422</guid>
      <dc:creator>alexanthonymaj0</dc:creator>
      <dc:date>2019-04-18T01:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable based on Count of 2 other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-based-on-Count-of-2-other-variables/m-p/551981#M153434</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
&amp;nbsp; select Report_Month,&amp;nbsp;count(unique&amp;nbsp;Custer_ID) as Count
&amp;nbsp; from&amp;nbsp;Sales_Details
&amp;nbsp; group by&amp;nbsp;Report_Month;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 03:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-based-on-Count-of-2-other-variables/m-p/551981#M153434</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-18T03:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new variable based on Count of 2 other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-based-on-Count-of-2-other-variables/m-p/552013#M153447</link>
      <description>&lt;P&gt;Yes, thank you so much for your reply, I am really appreciative! I have a couple of follow-up questions, if you don't mind.&lt;BR /&gt;&lt;BR /&gt;First off, I am trying to group the variables (1) Count_Customer (2) Count_Sales_Rep (3) Sales_Volume based on&lt;BR /&gt;&lt;BR /&gt;(1) the Channel 'Sales_Channel' and (2) the Month 'Report_Month'&amp;nbsp; -- I know the results I am getting are not correct (I have attached to this post). How would I go about achieving this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;create table work.sales_summary1 AS&lt;BR /&gt;select report_month, count(unique Customer_ID) as Count_Customer, count(unique Sales_Rep_ID) as Count_Sales_Rep, Sales_Volume, Sales_Channel&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;from sales_details&lt;BR /&gt;group by Report_Month and Sales_Channel;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 06:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-new-variable-based-on-Count-of-2-other-variables/m-p/552013#M153447</guid>
      <dc:creator>alexanthonymaj0</dc:creator>
      <dc:date>2019-04-18T06:52:22Z</dc:date>
    </item>
  </channel>
</rss>

