<?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 Proc SQL Help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396367#M95687</link>
    <description>&lt;P&gt;CAST isn't a SAS function, you would use PUT instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What type of SQL is that?&amp;nbsp;&lt;BR /&gt;I though the variable name was always at the end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This may be easier if you show what you have and what you need, there may be other ways in SAS that are more efficient?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Sep 2017 14:50:22 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-09-15T14:50:22Z</dc:date>
    <item>
      <title>SAS Proc SQL Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396351#M95683</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS. I am trying to write the below SQL script in SAS and wrap in Proc SQL&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FinalStatus = CAST(SUBSTRING(MAX(CAST(cl.DateNotesEntered AS BINARY(6)) + CAST(cl.CallResult AS VARBINARY(1000))), 7, 1000) AS VARCHAR(1000)),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on how this statement would be written in Proc SQL for SAS&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 14:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396351#M95683</guid>
      <dc:creator>Reggiete</dc:creator>
      <dc:date>2017-09-15T14:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Proc SQL Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396367#M95687</link>
      <description>&lt;P&gt;CAST isn't a SAS function, you would use PUT instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What type of SQL is that?&amp;nbsp;&lt;BR /&gt;I though the variable name was always at the end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This may be easier if you show what you have and what you need, there may be other ways in SAS that are more efficient?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 14:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396367#M95687</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-15T14:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Proc SQL Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396372#M95689</link>
      <description>&lt;P&gt;yes you are right the variable name is normally at the end but you can also put it in the beginning. the SQL code above was writen in SQL server.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically what the line of sql is giving the max status for the max date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so for example, below i would want to return the max status which is the record with the greatest date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Max status would be Completed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Status&lt;/P&gt;&lt;P&gt;Example &amp;nbsp; &amp;nbsp; &amp;nbsp;1/1/2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Open&lt;/P&gt;&lt;P&gt;Example &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/3/2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pending&lt;/P&gt;&lt;P&gt;Example &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1/4/2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Completed&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 14:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396372#M95689</guid>
      <dc:creator>Reggiete</dc:creator>
      <dc:date>2017-09-15T14:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Proc SQL Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396375#M95690</link>
      <description>&lt;P&gt;Do you have to use SQL?&lt;/P&gt;
&lt;P&gt;A Data Step does this very easily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
by a date;
run;

data want;
set have;
by a date;
if last.a; *takes the last record of each A group;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Sep 2017 15:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396375#M95690</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-15T15:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Proc SQL Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396379#M95692</link>
      <description>&lt;P&gt;Yes i would prefer sql since i have a entire statement i am running to create a table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 15:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396379#M95692</guid>
      <dc:creator>Reggiete</dc:creator>
      <dc:date>2017-09-15T15:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Proc SQL Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396381#M95693</link>
      <description>&lt;P&gt;I think you'll have to do a subquery and join then, I don't think this will translate into SAS code directly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 15:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396381#M95693</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-15T15:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Proc SQL Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396414#M95702</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165282"&gt;@Reggiete&lt;/a&gt;&amp;nbsp; I'm not sure if I understood your req as I am wondering what is the big deal in proc sql. Please let me know if i'm missing something:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;input A&amp;nbsp;&amp;nbsp; : $10.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date&amp;nbsp;&amp;nbsp; :mmddyy10.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Status $; /*assuming the date is mmddyy10.*/&lt;/P&gt;&lt;P&gt;format date mmddyy10.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;Example&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/1/2017&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Open&lt;/P&gt;&lt;P&gt;Example&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/3/2017&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Pending&lt;/P&gt;&lt;P&gt;Example&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1/4/2017&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Completed&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from have&lt;/P&gt;&lt;P&gt;group by a&lt;/P&gt;&lt;P&gt;having date=max(date);&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 16:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Proc-SQL-Help/m-p/396414#M95702</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-09-15T16:20:03Z</dc:date>
    </item>
  </channel>
</rss>

