<?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: nested case when leads to reemerging summary stats in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565005#M75006</link>
    <description>Can you please show an example of your expected output?</description>
    <pubDate>Mon, 10 Jun 2019 18:51:26 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-06-10T18:51:26Z</dc:date>
    <item>
      <title>nested case when leads to reemerging summary stats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/564983#M75003</link>
      <description>&lt;P&gt;The sql procedure below gave me "The query requires remerging summary statistics back with the original data."&amp;nbsp; &amp;nbsp; I'd like to group the results so I have one row for each st and one column for each yr.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;input yr 4. st $2. typ 1.;&lt;BR /&gt;datalines;&lt;BR /&gt;2014AL1&lt;BR /&gt;2014AL2&lt;BR /&gt;2014AL3&lt;BR /&gt;2014AL1&lt;BR /&gt;2015AL2&lt;BR /&gt;2015AL3&lt;BR /&gt;2014AR1&lt;BR /&gt;2015AR1&lt;BR /&gt;2015AR2&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select st,&lt;BR /&gt;case when yr=2014 then mean(case when typ=1 then 1 else 0 end) else . end as pct14,&lt;BR /&gt;case when yr=2015 then mean(case when typ=1 then 1 else 0 end) else . end as pct15&lt;BR /&gt;from a&lt;BR /&gt;group by st;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:50:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/564983#M75003</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2019-06-10T17:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: nested case when leads to reemerging summary stats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565005#M75006</link>
      <description>Can you please show an example of your expected output?</description>
      <pubDate>Mon, 10 Jun 2019 18:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565005#M75006</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-10T18:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: nested case when leads to reemerging summary stats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565013#M75012</link>
      <description>&lt;P&gt;something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ST&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2014&amp;nbsp; &amp;nbsp;2015&lt;/P&gt;&lt;P&gt;AL&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;50%&amp;nbsp; &amp;nbsp; &amp;nbsp; 0%&lt;/P&gt;&lt;P&gt;AR&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0%&amp;nbsp; &amp;nbsp; &amp;nbsp;50%&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 19:17:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565013#M75012</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2019-06-10T19:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: nested case when leads to reemerging summary stats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565016#M75013</link>
      <description>&lt;P&gt;Sometimes, SQL isn't the right tool.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input yr 4. st $2. typ 1.;
if typ=1 then value=1; else value=0;
datalines;
2014AL1
2014AL2
2014AL3
2014AL1
2015AL2
2015AL3
2014AR1
2015AR1
2015AR2
;
run;

proc report data=a;
    columns st yr,value;
	define st/group "State";
	define yr/across "Year";
	define value/mean "Percent" format=percent7.0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jun 2019 19:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565016#M75013</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-06-10T19:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: nested case when leads to reemerging summary stats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565020#M75014</link>
      <description>&lt;P&gt;ok, I was trying to avoid the additional data step but I accept that sql isn't well equipped in this case.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 19:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565020#M75014</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2019-06-10T19:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: nested case when leads to reemerging summary stats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565022#M75015</link>
      <description>&lt;P&gt;But it's not an "additional step", where you had PROC SQL before, you now have PROC REPORT, that's the same number of steps.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 19:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565022#M75015</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-06-10T19:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: nested case when leads to reemerging summary stats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565082#M75017</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;But it's not an "additional step", where you had PROC SQL before, you now have PROC REPORT, that's the same number of steps.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;AND fewer lines of code. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 23:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/565082#M75017</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-10T23:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: nested case when leads to reemerging summary stats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/566015#M75058</link>
      <description>&lt;P&gt;The if statement would have required an additional step given my original data step, but I accept your larger point.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 20:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/nested-case-when-leads-to-reemerging-summary-stats/m-p/566015#M75058</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2019-06-13T20:04:13Z</dc:date>
    </item>
  </channel>
</rss>

