<?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: Group by and create new column in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304494#M20654</link>
    <description>&lt;P&gt;How is this different from your last question?&lt;/P&gt;
&lt;P&gt;What do you have so far?&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2016 22:32:48 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-10-13T22:32:48Z</dc:date>
    <item>
      <title>Group by and create new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304484#M20652</link>
      <description>&lt;P&gt;Hi All -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following columns:&lt;/P&gt;
&lt;P&gt;MONTHS, YEAR, ACCOUNT NUMBERS and SCORE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Im using Proc sql;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need a table that will do a group by that will give me&amp;nbsp;&lt;/P&gt;
&lt;P&gt;all the months ( as one column), amount of accounts for that months and SEPARATE the score with PASS and FAIL ( so 2 separate columns for SCORE)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thus need to sum up all the pass and/ fails and create its own columns&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I will see all the accounts for say january and all the pass and fails for those accounts in jan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THANK YOU!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 20:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304484#M20652</guid>
      <dc:creator>itshere</dc:creator>
      <dc:date>2016-10-13T20:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and create new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304494#M20654</link>
      <description>&lt;P&gt;How is this different from your last question?&lt;/P&gt;
&lt;P&gt;What do you have so far?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 22:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304494#M20654</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-13T22:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and create new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304496#M20655</link>
      <description>&lt;P&gt;Is this a report or do you need a data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you mean by "amount of accounts"? Is that the number of unique accounts or total number of records or something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do we know what a PASS or FAIL is? You don't have a variable or supply a rule.&lt;/P&gt;
&lt;P&gt;It will help if you can provide some example data. Instructions here &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will create text of a data step that you can post here so we can test code.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 22:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304496#M20655</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-13T22:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and create new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304665#M20665</link>
      <description>&lt;P&gt;total number of records for account numbers.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pass and fail is currently in one column as 1 or 0. need to separate it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 13:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304665#M20665</guid>
      <dc:creator>itshere</dc:creator>
      <dc:date>2016-10-14T13:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and create new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304666#M20666</link>
      <description>&lt;P&gt;Proc SQL;&lt;/P&gt;
&lt;P&gt;create table want as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum(pass=0) as fail,&lt;/P&gt;
&lt;P&gt;sum(pass=1) as pass&lt;/P&gt;
&lt;P&gt;from ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is VERY similar to last question, except for pass/fail which is noted above. You should be able to combine two answers to get your desired results.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 13:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304666#M20666</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-14T13:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and create new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304683#M20667</link>
      <description>&lt;P&gt;This is how my data looks: (sample)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;year &amp;nbsp; &amp;nbsp; Month &amp;nbsp; Account &amp;nbsp; &amp;nbsp;Pass/Fail&lt;/P&gt;
&lt;P&gt;2016 &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;44402 &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;2016 &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 99921 &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;
&lt;P&gt;2016 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11233 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table test1&amp;nbsp;as&lt;BR /&gt;select &lt;BR /&gt;year,&lt;BR /&gt;month,&lt;BR /&gt;sum(passfail=1)as pass, &lt;BR /&gt;sum(passfail=0)as fail,&lt;BR /&gt;Count(*) as count&lt;BR /&gt;From&amp;nbsp;testorg&lt;BR /&gt;group by year, month,&amp;nbsp;pass,fail&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doesnt work tho.. am i not able to add new columns and do a group by in the same query?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 14:21:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304683#M20667</guid>
      <dc:creator>itshere</dc:creator>
      <dc:date>2016-10-14T14:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and create new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304691#M20668</link>
      <description>&lt;P&gt;Describe how "it doesn't work". If there are errors post the log with the code and the errors, if you get unexpected output show the output actually resulting and the desired outcome.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 14:44:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304691#M20668</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-14T14:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and create new column</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304743#M20675</link>
      <description>&lt;P&gt;You can but your group by is the level you want to summarize on. PASS/FAIL should not be in your group by.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As indicated by someone else 'doesn't work tho' doesn't tell anyone anything about how something doesn't work. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 17:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Group-by-and-create-new-column/m-p/304743#M20675</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-14T17:47:33Z</dc:date>
    </item>
  </channel>
</rss>

