<?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/53771#M14880</link>
    <description>Thank you Linus ,&lt;BR /&gt;
I appreciate the time you spend on it !&lt;BR /&gt;
In sas code its realy not a problem but I was curious if it can be done with sql.&lt;BR /&gt;
I tried to think about  a way to solve it and nothing  cross my mind.&lt;BR /&gt;
Thanks again for your help!!!</description>
    <pubDate>Tue, 14 Oct 2008 21:11:49 GMT</pubDate>
    <dc:creator>yonib</dc:creator>
    <dc:date>2008-10-14T21:11:49Z</dc:date>
    <item>
      <title>PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL/m-p/53768#M14877</link>
      <description>HI all,&lt;BR /&gt;
&lt;BR /&gt;
l have a problem that i succeed doing it with sas code but i wondering if its possible doing it with sql;&lt;BR /&gt;
&lt;BR /&gt;
for example:&lt;BR /&gt;
data temp;&lt;BR /&gt;
input x;&lt;BR /&gt;
cards;&lt;BR /&gt;
1&lt;BR /&gt;
1&lt;BR /&gt;
1&lt;BR /&gt;
2&lt;BR /&gt;
2&lt;BR /&gt;
3&lt;BR /&gt;
3&lt;BR /&gt;
3&lt;BR /&gt;
3&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
i want my output be like:&lt;BR /&gt;
1 1&lt;BR /&gt;
1 2&lt;BR /&gt;
1 3&lt;BR /&gt;
2 1&lt;BR /&gt;
2 2&lt;BR /&gt;
3 1&lt;BR /&gt;
3 2&lt;BR /&gt;
3 3&lt;BR /&gt;
3 4&lt;BR /&gt;
......&lt;BR /&gt;
Thanks in advance,</description>
      <pubDate>Tue, 14 Oct 2008 12:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL/m-p/53768#M14877</guid>
      <dc:creator>yonib</dc:creator>
      <dc:date>2008-10-14T12:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL/m-p/53769#M14878</link>
      <description>Well, I guess it can be done. Is this a real world problem? Nevertheless, I was a bit curious too, so this is what I came up with (given your input data):&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select temp.x, monotonic() as m, calculated m +1 - rowNo as y&lt;BR /&gt;
from temp inner join &lt;BR /&gt;
(select x, min(monotonic()) as rowNo&lt;BR /&gt;
from temp&lt;BR /&gt;
group by x) as r&lt;BR /&gt;
on temp.x eq r.x;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
One strange thing is that I had to put the result of the monotonic function in a column before using it in a calculation, otherwise, I got totally different result. Maybe some SAS person can explain that (the monotonic was just until recently unsupported and still pretty undocumented).&lt;BR /&gt;
&lt;BR /&gt;
But the baseline is that the SQL code isn't especially pretty, and if you are using SAS, the data step will probably a better choice for this problem.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Tue, 14 Oct 2008 17:11:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL/m-p/53769#M14878</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-10-14T17:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL/m-p/53770#M14879</link>
      <description>Thanks! According to the usage note: &lt;A href="http://support.sas.com/kb/15/138.html" target="_blank"&gt;http://support.sas.com/kb/15/138.html&lt;/A&gt;, monotonic() function is unsupported in proc sql.</description>
      <pubDate>Tue, 14 Oct 2008 17:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL/m-p/53770#M14879</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-14T17:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL/m-p/53771#M14880</link>
      <description>Thank you Linus ,&lt;BR /&gt;
I appreciate the time you spend on it !&lt;BR /&gt;
In sas code its realy not a problem but I was curious if it can be done with sql.&lt;BR /&gt;
I tried to think about  a way to solve it and nothing  cross my mind.&lt;BR /&gt;
Thanks again for your help!!!</description>
      <pubDate>Tue, 14 Oct 2008 21:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL/m-p/53771#M14880</guid>
      <dc:creator>yonib</dc:creator>
      <dc:date>2008-10-14T21:11:49Z</dc:date>
    </item>
  </channel>
</rss>

