<?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: sas sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241490#M308931</link>
    <description>&lt;P&gt;I suspect that what you need is not &lt;STRONG&gt;SQL&lt;/STRONG&gt; but &lt;STRONG&gt;proc rank&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length name $12 rating 8 post $12;
input name   rating  post;
cards;
a  2  ASE
b  3  ASE
c  4  ITA
d  5  ITA
e  2  VP
f  7  Vp
;

proc rank data=have out=want ties=dense;
var rating;
ranks ratingRank;
run;

proc print data=want noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if not, tell us what you expect as a result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 02 Jan 2016 05:31:51 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-01-02T05:31:51Z</dc:date>
    <item>
      <title>sas sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241488#M308930</link>
      <description>&lt;P&gt;i have aa data set&amp;nbsp;&lt;/P&gt;&lt;P&gt;data t;&lt;/P&gt;&lt;P&gt;name &amp;nbsp; rating &amp;nbsp;post;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;a &amp;nbsp; 2 &amp;nbsp; ASE&lt;/P&gt;&lt;P&gt;b &amp;nbsp; 3 &amp;nbsp; ASE&lt;/P&gt;&lt;P&gt;c &amp;nbsp;4 &amp;nbsp; &amp;nbsp;ITA&lt;/P&gt;&lt;P&gt;d &amp;nbsp;5 &amp;nbsp; ITA&lt;/P&gt;&lt;P&gt;e &amp;nbsp;2 &amp;nbsp;VP&lt;/P&gt;&lt;P&gt;f &amp;nbsp; 7 &amp;nbsp;Vp&lt;/P&gt;&lt;P&gt;;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want to knw the rating of each person out of whole rating and performed the following query&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select first_name,(calculated rating/r) from pawan.test,(select sum(rating) as r from pawan.test1);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;getting error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR: It appears that the CALCULATED variable rating was referenced before it was defined.&lt;BR /&gt;ERROR: The following columns were not found in the contributing tables: post.&lt;BR /&gt;ERROR: The following columns were not found as CALCULATED references in the immediate query: rating.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jan 2016 04:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241488#M308930</guid>
      <dc:creator>pawandh</dc:creator>
      <dc:date>2016-01-02T04:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: sas sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241490#M308931</link>
      <description>&lt;P&gt;I suspect that what you need is not &lt;STRONG&gt;SQL&lt;/STRONG&gt; but &lt;STRONG&gt;proc rank&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length name $12 rating 8 post $12;
input name   rating  post;
cards;
a  2  ASE
b  3  ASE
c  4  ITA
d  5  ITA
e  2  VP
f  7  Vp
;

proc rank data=have out=want ties=dense;
var rating;
ranks ratingRank;
run;

proc print data=want noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if not, tell us what you expect as a result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jan 2016 05:31:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241490#M308931</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-01-02T05:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: sas sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241491#M308932</link>
      <description>i want that for "a" total_rating is "2/sum(rating)"&lt;BR /&gt;and for "b" is "3/sum(rating)" like so on&lt;BR /&gt;</description>
      <pubDate>Sat, 02 Jan 2016 06:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241491#M308932</guid>
      <dc:creator>pawandh</dc:creator>
      <dc:date>2016-01-02T06:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: sas sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241492#M308933</link>
      <description>&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Proc sql;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Select *,rating/(select sum(rating) from t) as total_rating&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;From t;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"&gt;Quit;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jan 2016 06:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241492#M308933</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-01-02T06:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: sas sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241499#M308934</link>
      <description>&lt;P&gt;SAS SQL can accomplish this fairly easily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *, rating/sum(rating) as pct_rating
from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Jan 2016 13:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-sql/m-p/241499#M308934</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-02T13:45:04Z</dc:date>
    </item>
  </channel>
</rss>

