<?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: Proc sql question in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152194#M40027</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like the following may work:&lt;/P&gt;&lt;P&gt;If it doesn't, post sample data and sample expected output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table neo.regtest1 as&lt;/P&gt;&lt;P&gt;select * , sum(absvolume*(venues=1)) as venuesT1 &lt;/P&gt;&lt;P&gt;from neo.regtest&lt;/P&gt;&lt;P&gt;group by cptyname;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Nov 2013 17:31:28 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-11-21T17:31:28Z</dc:date>
    <item>
      <title>Proc sql question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152193#M40026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to calculate the sum of a variable per group &lt;STRONG&gt;when/conditional &lt;/STRONG&gt;that another variable, venues=1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried the code below and does not net the correct resutls. I also tried using 'having'. Both having and where, keep in the produced table only those rows where venues=1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to have the sum for those where venues=1 but in this column (venuest1) also keep the rest of the rows in the dataset where venues ne 1, simply add them by = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so the code in my opinion should include something of the type if venues=1 then do,&amp;nbsp; 'else' venuest1=0 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am a beginnger in proc SQL so any suggestions how to solve this are more than welcome. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table neo.regtest1 as&lt;/P&gt;&lt;P&gt;select * , sum(absvolume) as venuesT1 &lt;/P&gt;&lt;P&gt;from neo.regtest&lt;/P&gt;&lt;P&gt;where venues=1&lt;/P&gt;&lt;P&gt;group by cptyname;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in advance!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 17:26:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152193#M40026</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-11-21T17:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152194#M40027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like the following may work:&lt;/P&gt;&lt;P&gt;If it doesn't, post sample data and sample expected output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table neo.regtest1 as&lt;/P&gt;&lt;P&gt;select * , sum(absvolume*(venues=1)) as venuesT1 &lt;/P&gt;&lt;P&gt;from neo.regtest&lt;/P&gt;&lt;P&gt;group by cptyname;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 17:31:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152194#M40027</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-11-21T17:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152195#M40028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to include sample data, otherwise it is next to impossible to suggest anything helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 17:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152195#M40028</guid>
      <dc:creator>Marina</dc:creator>
      <dc:date>2013-11-21T17:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc sql question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152196#M40029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;worked &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; thanks for the timely feedback&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 18:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-sql-question/m-p/152196#M40029</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-11-21T18:36:10Z</dc:date>
    </item>
  </channel>
</rss>

