<?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 trying to solve for &amp;quot;summing case staement results &amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/trying-to-solve-for-quot-summing-case-staement-results-quot/m-p/798584#M313961</link>
    <description>&lt;P&gt;I am trying to solve for the following, my ouput is below for a visual: I want to sum 'cert_count' for the the 1's and the 0's grouped by aor_code. for examplel I want to have another column next to&amp;nbsp;'cert_count' that sums the number of 1's for aor_code K110 and does the same to count the number of 0's for aor_code K110. Can someone offer a solution? I tried to do a sum within the case statement and could not get it to run.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lisa_Sessions_0-1645802567591.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68851iD7CDABF397086231/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lisa_Sessions_0-1645802567591.png" alt="Lisa_Sessions_0-1645802567591.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; create table Ready_To_Sale  as
 Select distinct 
 	AGENCY_NAME,
	AOR_CODE,
	AGENCY_TYPE,
	AGENCY_TIER,
	AGENT_NAME,
	AGENT_INDIVIDUAL_WRITING_NUMBER, 
	count (distinct LICENSE) as 'Agent_Count'n,
	CERTIFICATION_STATUS,
	COUNTY
	From MedicareSalesAgencies 
	where CERTIFICATION_STATUS not in ('READY TO SELL 2021')
	group by aor_code
;
quit;

Proc sql; Create table Ready_To_Sale2 as 
Select distinct
*,
Case 
when certification_status in ('READY TO SELL 2022') then 1 else 0 end as 'cert_count'n
From Ready_To_Sale a
;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 25 Feb 2022 15:32:11 GMT</pubDate>
    <dc:creator>LMSSAS</dc:creator>
    <dc:date>2022-02-25T15:32:11Z</dc:date>
    <item>
      <title>trying to solve for "summing case staement results "</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trying-to-solve-for-quot-summing-case-staement-results-quot/m-p/798584#M313961</link>
      <description>&lt;P&gt;I am trying to solve for the following, my ouput is below for a visual: I want to sum 'cert_count' for the the 1's and the 0's grouped by aor_code. for examplel I want to have another column next to&amp;nbsp;'cert_count' that sums the number of 1's for aor_code K110 and does the same to count the number of 0's for aor_code K110. Can someone offer a solution? I tried to do a sum within the case statement and could not get it to run.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lisa_Sessions_0-1645802567591.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/68851iD7CDABF397086231/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Lisa_Sessions_0-1645802567591.png" alt="Lisa_Sessions_0-1645802567591.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; create table Ready_To_Sale  as
 Select distinct 
 	AGENCY_NAME,
	AOR_CODE,
	AGENCY_TYPE,
	AGENCY_TIER,
	AGENT_NAME,
	AGENT_INDIVIDUAL_WRITING_NUMBER, 
	count (distinct LICENSE) as 'Agent_Count'n,
	CERTIFICATION_STATUS,
	COUNTY
	From MedicareSalesAgencies 
	where CERTIFICATION_STATUS not in ('READY TO SELL 2021')
	group by aor_code
;
quit;

Proc sql; Create table Ready_To_Sale2 as 
Select distinct
*,
Case 
when certification_status in ('READY TO SELL 2022') then 1 else 0 end as 'cert_count'n
From Ready_To_Sale a
;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Feb 2022 15:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trying-to-solve-for-quot-summing-case-staement-results-quot/m-p/798584#M313961</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-02-25T15:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: trying to solve for "summing case staement results "</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trying-to-solve-for-quot-summing-case-staement-results-quot/m-p/798614#M313964</link>
      <description>&lt;P&gt;&lt;SPAN&gt;We cannot write code to work with data in a screen capture, data should be provided as SAS data step code and not in any other format. So this code is UNTESTED.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql; 
Create table Ready_To_Sale2 as 
Select distinct
*,
sum(certification_status eq 'READY TO SELL 2022') as cert_count
From Ready_To_Sale a
group by aor_code
;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Feb 2022 15:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trying-to-solve-for-quot-summing-case-staement-results-quot/m-p/798614#M313964</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-25T15:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: trying to solve for "summing case staement results "</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trying-to-solve-for-quot-summing-case-staement-results-quot/m-p/798630#M313967</link>
      <description>Thank you!</description>
      <pubDate>Fri, 25 Feb 2022 16:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trying-to-solve-for-quot-summing-case-staement-results-quot/m-p/798630#M313967</guid>
      <dc:creator>LMSSAS</dc:creator>
      <dc:date>2022-02-25T16:25:30Z</dc:date>
    </item>
  </channel>
</rss>

