<?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 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384259#M65639</link>
    <description>If you dont mind can you please explain this query, how (select sum(MARKS) from TEST where ID &amp;lt;= A.ID) as TOTAL&lt;BR /&gt;from TEST A;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;is working. Please its a request ...&lt;BR /&gt;&lt;BR /&gt;because i am unable to figure out how the id is comparing to a.id ..because we are not using the self join here</description>
    <pubDate>Mon, 31 Jul 2017 13:14:09 GMT</pubDate>
    <dc:creator>shivamarrora0</dc:creator>
    <dc:date>2017-07-31T13:14:09Z</dc:date>
    <item>
      <title>proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384193#M65635</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the below output &amp;nbsp;using proc sql... Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14228i50808A07C8EC6554/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 10:19:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384193#M65635</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-07-31T10:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384201#M65636</link>
      <description>&lt;P&gt;Why do you need to use SQL? &amp;nbsp;Datastep is far better suited to this. &amp;nbsp;Untested code here, post test data in the form of a datastep as text in a code window ({i} above post)!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  *,
          (select sum(MARKS) from TOTAL where ID &amp;lt;= A.ID) as TOTAL
  from    TEST A;
quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 10:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384201#M65636</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-31T10:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384247#M65637</link>
      <description>&lt;BR /&gt;data test;&lt;BR /&gt;input id marks;&lt;BR /&gt;cards;&lt;BR /&gt;1 10&lt;BR /&gt;2 20&lt;BR /&gt;3 30&lt;BR /&gt;4 40&lt;BR /&gt;;&lt;BR /&gt;</description>
      <pubDate>Mon, 31 Jul 2017 12:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384247#M65637</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-07-31T12:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384249#M65638</link>
      <description>&lt;PRE&gt;data test;
input id marks;
cards;
1 10
2 20
3 30
4 40
;
run;
proc sql;
  create table WANT as
  select  *,
          (select sum(MARKS) from TEST where ID &amp;lt;= A.ID) as TOTAL
  from    TEST A;
quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Jul 2017 12:55:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384249#M65638</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-31T12:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384259#M65639</link>
      <description>If you dont mind can you please explain this query, how (select sum(MARKS) from TEST where ID &amp;lt;= A.ID) as TOTAL&lt;BR /&gt;from TEST A;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;is working. Please its a request ...&lt;BR /&gt;&lt;BR /&gt;because i am unable to figure out how the id is comparing to a.id ..because we are not using the self join here</description>
      <pubDate>Mon, 31 Jul 2017 13:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384259#M65639</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-07-31T13:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384261#M65640</link>
      <description>&lt;P&gt;Its called a subquery. &amp;nbsp;A.ID is from the outer query, the sub query is getting all records with ID less than the row from A and summing them up. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 13:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384261#M65640</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-31T13:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384315#M65642</link>
      <description>i wrote the below query and its working fine but i have compared and the group by them..But in your query how it is getting grouped ...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select distinct test.marks,test.id ,sum(a.marks) as total from test,test as a where a.marks le test.marks group by test.id;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 31 Jul 2017 15:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384315#M65642</guid>
      <dc:creator>shivamarrora0</dc:creator>
      <dc:date>2017-07-31T15:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384334#M65648</link>
      <description>&lt;P&gt;It is not being "grouped" it is a sub-query. &amp;nbsp;So one first iteration, the subquery sums() up everything with an id &amp;lt; 10 and returns that, then next iteration id &amp;lt;20 returns that on and on. &amp;nbsp;You may want to have a readup on SQL and how it works.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2017 15:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-sql/m-p/384334#M65648</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-31T15:55:37Z</dc:date>
    </item>
  </channel>
</rss>

