<?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 proc sql in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/proc-sql/m-p/556469#M7509</link>
    <description>&lt;P&gt;Hi&amp;nbsp; Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a help in sas problem statement. I have a data set which I have attached in attachment below in which I have two question-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1, in attached file I have divide the amtspent into three categories- below 100, 100-200 and above 200 .&lt;/P&gt;&lt;P&gt;2. I want to count the number of unique customers in each group(using select case when)&lt;/P&gt;&lt;P&gt;I have tried below code but unable to find the solution-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select custid&lt;BR /&gt;case&lt;BR /&gt;when amtspent = "below 100" then count(distinct custid)&lt;BR /&gt;when amtspent = "100-200" then count(distinct custid)&lt;BR /&gt;when amtspent = "above 200" then count(distinct custid)&lt;BR /&gt;else count(distinct custid)&lt;BR /&gt;end as "unique customer"&lt;BR /&gt;from grv&lt;BR /&gt;group by amtspent&lt;BR /&gt;quit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2019 16:08:28 GMT</pubDate>
    <dc:creator>Manojahuja1418</dc:creator>
    <dc:date>2019-05-06T16:08:28Z</dc:date>
    <item>
      <title>proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Studio/proc-sql/m-p/556469#M7509</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a help in sas problem statement. I have a data set which I have attached in attachment below in which I have two question-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1, in attached file I have divide the amtspent into three categories- below 100, 100-200 and above 200 .&lt;/P&gt;&lt;P&gt;2. I want to count the number of unique customers in each group(using select case when)&lt;/P&gt;&lt;P&gt;I have tried below code but unable to find the solution-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select custid&lt;BR /&gt;case&lt;BR /&gt;when amtspent = "below 100" then count(distinct custid)&lt;BR /&gt;when amtspent = "100-200" then count(distinct custid)&lt;BR /&gt;when amtspent = "above 200" then count(distinct custid)&lt;BR /&gt;else count(distinct custid)&lt;BR /&gt;end as "unique customer"&lt;BR /&gt;from grv&lt;BR /&gt;group by amtspent&lt;BR /&gt;quit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 16:08:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/proc-sql/m-p/556469#M7509</guid>
      <dc:creator>Manojahuja1418</dc:creator>
      <dc:date>2019-05-06T16:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Studio/proc-sql/m-p/556507#M7510</link>
      <description>&lt;P&gt;Proper syntax would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select 
    amtspent,
    count(distinct custid) as uniqueCustomers
from grv
group by amtspent;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 17:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/proc-sql/m-p/556507#M7510</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-05-06T17:40:26Z</dc:date>
    </item>
  </channel>
</rss>

