<?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: Using TSQL in SAS and issue with CASE Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313867#M68272</link>
    <description>&lt;P&gt;So this is from one variable called " Dlr_Name&amp;nbsp;"?&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2016 19:25:58 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2016-11-23T19:25:58Z</dc:date>
    <item>
      <title>Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313850#M68263</link>
      <description>&lt;P&gt;I have&amp;nbsp;data imputs&amp;nbsp;in my data that I need to change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first one is CarMax # 10000 and the other is DriveTime 10000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want all instances of&amp;nbsp;CarMax # 100000&amp;nbsp;to be "CarMax"&amp;nbsp; and DriveTime 10000 to be "DriveTime".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They both have different locations so it could be 100001, 100002 and so on same for DriveTime.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CASE WHEN Sales.Dlr_Name LIKE 'CarMax%'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN "CarMax"&lt;BR /&gt;WHEN LEFT (Sales.Dlr_Name,9)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN "Drivetime"&lt;BR /&gt;ELSE Sales.Dlr_Name&lt;BR /&gt;END AS Dlr_Name,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use this it only returns CarMax in the results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help, please&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 17:54:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313850#M68263</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-23T17:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313851#M68264</link>
      <description>&lt;P&gt;I mixed up the codes from when I pasted it, was trying either the LIKE or the LEFT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LIKE only brought back Carmax, LEFT did the same thing.....&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 17:56:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313851#M68264</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-23T17:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313853#M68265</link>
      <description>&lt;P&gt;Your syntax is a little off, you will need two 'CASE WHEN .... END' for two variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 18:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313853#M68265</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-11-23T18:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313858#M68268</link>
      <description>Right, like I said, I copied the "in progress" one. Here it is:&lt;BR /&gt;&lt;BR /&gt;CASE WHEN Sales.Dlr_Name LIKE 'CarMax%'&lt;BR /&gt;THEN "CarMax"&lt;BR /&gt;CASE WHEN Sales.Dlr_Name LIKE 'Drivetime%'&lt;BR /&gt;THEN "Drivetime"&lt;BR /&gt;ELSE Sales.Dlr_Name&lt;BR /&gt;END AS Dlr_Name,</description>
      <pubDate>Wed, 23 Nov 2016 19:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313858#M68268</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-23T19:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313860#M68270</link>
      <description>&lt;P&gt;Give a few examples of your incoming data and your expected outcomes, if you could.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 19:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313860#M68270</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-11-23T19:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313862#M68271</link>
      <description>CARMAX #7157&lt;BR /&gt;CARMAX #7521&lt;BR /&gt;CARMAX AUTO SUPERSTORES INC&lt;BR /&gt;&lt;BR /&gt;These need to change to CarMax&lt;BR /&gt;&lt;BR /&gt;DRIVETIME CAR SALES (PHOENIX&amp;lt; AZ)&lt;BR /&gt;DRIVETIME-BUYING ACCT&lt;BR /&gt;&lt;BR /&gt;Should be DRIVETIME&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Nov 2016 19:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313862#M68271</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-23T19:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313867#M68272</link>
      <description>&lt;P&gt;So this is from one variable called " Dlr_Name&amp;nbsp;"?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 19:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313867#M68272</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-11-23T19:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313870#M68274</link>
      <description>Yes it is, this is what I have tried so far:&lt;BR /&gt;&lt;BR /&gt;CASE WHEN LEFT (Sales.Dlr_Name,6) = "CARMAX"&lt;BR /&gt;THEN "CARMAX"&lt;BR /&gt;WHEN LEFT (Sales.Dlr_Name,9) = "DRIVETIME"&lt;BR /&gt;THEN "DRIVETIME"&lt;BR /&gt;ELSE Sales.Dlr_Name&lt;BR /&gt;END AS Dlr_Name,&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Nov 2016 19:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313870#M68274</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-23T19:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313874#M68275</link>
      <description>&lt;P&gt;If you are using explicit pass-through method to access T-SQL from SAS, I have no idea what happened. You seem to have coded just right. If you are not using pass-through, then you will need change your code to the SAS SQL style. for example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when upcase(left(Sales.Dlr_Name)) eqt 'CARMAX' THEN 'CARMAX'
     WHEN upcase(left(Sales.Dlr_Name)) eqt 'DRIVETIME' then 'DRIVETIME'
	 ELSE Sales.Dlr_Name
END AS Dlr_Name&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or using substr, like, contain, find or index functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 19:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313874#M68275</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-11-23T19:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using TSQL in SAS and issue with CASE Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313881#M68279</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp; I added the UPCASE and the () around LEFT() and used EQT instead of = and bingo in business.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 20:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-TSQL-in-SAS-and-issue-with-CASE-Statement/m-p/313881#M68279</guid>
      <dc:creator>TMiller16</dc:creator>
      <dc:date>2016-11-23T20:07:18Z</dc:date>
    </item>
  </channel>
</rss>

