<?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: Translating SAS code to SQL in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530377#M5748</link>
    <description>&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
    <pubDate>Sat, 26 Jan 2019 21:25:16 GMT</pubDate>
    <dc:creator>BigVinnie</dc:creator>
    <dc:date>2019-01-26T21:25:16Z</dc:date>
    <item>
      <title>Translating SAS code to SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530303#M5733</link>
      <description>&lt;P&gt;Hello Everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am completely new to the world of SAS and I need to translate a SAS case stateemnt to SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the line of code&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;WHEN (INDEX(UPCASE(SALES_STATUS), 'FORM RECEIVED')) &amp;gt;= 1 THEN 'Form Received'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;a) In English what is this line of code doing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;b) how would I write this in SQL?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can't seem to get the functions or syntax to work in SQL.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be much appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Kind Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Vinnie&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 08:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530303#M5733</guid>
      <dc:creator>BigVinnie</dc:creator>
      <dc:date>2019-01-26T08:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Translating SAS code to SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530313#M5735</link>
      <description>&lt;P&gt;Welcome to the SAS communities. The questions are better answered reversed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;b) &lt;/STRONG&gt;The code in PROC SQL goes something like this&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 (case 
             when (index(upcase(sales_status), 'FORM RECEIVED')) &amp;gt;= 1 then 'Form Received' 
           end) as newvar
   from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;a)&amp;nbsp;&lt;/STRONG&gt;The code looks for the string "&lt;CODE class=" language-sas"&gt;FORM RECEIVED&lt;/CODE&gt;" (not considering case) in the variable sales_status. If the string is present, the variable newvar will have the value "Form Received".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 14:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530313#M5735</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-26T14:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Translating SAS code to SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530314#M5736</link>
      <description>&lt;P&gt;If you need to translate this to a non-SAS SQL system, you will probably have to replace index() and upcase() with functions available there. The rest of the code is standard SQL and should need to adaptation.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 14:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530314#M5736</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-26T14:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Translating SAS code to SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530318#M5737</link>
      <description>&lt;P&gt;Can you show more of the full code that you are trying to translate?&lt;/P&gt;
&lt;P&gt;I am confused because the snippet that you did show looks like it is part of an SQL CASE expression.&lt;/P&gt;
&lt;P&gt;Why would you need to translate SQL to SQL?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 15:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530318#M5737</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-26T15:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Translating SAS code to SQL</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530377#M5748</link>
      <description>&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 21:25:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Translating-SAS-code-to-SQL/m-p/530377#M5748</guid>
      <dc:creator>BigVinnie</dc:creator>
      <dc:date>2019-01-26T21:25:16Z</dc:date>
    </item>
  </channel>
</rss>

