<?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: Filtering for text the includes single quote in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/717075#M221731</link>
    <description>&lt;P&gt;Please provide an example of data where you are having trouble filtering.&amp;nbsp; (Note in your example you have mistakenly added an equal sign and typed a semi-colon instead of comma between the quoted list of values.)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table target as
  select *
  from source
  where value in ("Tom's Trucks" , "Carstop")
;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also since this is SQL code are you perhaps not running that WHERE clause in SAS but have actually pushed it into some remote database that has a different understanding of the meaning of double quote and single quotes?&lt;/P&gt;</description>
    <pubDate>Fri, 05 Feb 2021 14:29:13 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-02-05T14:29:13Z</dc:date>
    <item>
      <title>Filtering for text the includes single quote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/716683#M221532</link>
      <description>&lt;P&gt;Good evening:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm stuck creating a proc sql statement filtering for a value that includes a single quote (').&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC sql;
	create table target as
	select
		*
	from 
		source
	where
		value = "Tom's Trucks"
	quit;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 21:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/716683#M221532</guid>
      <dc:creator>sutzig</dc:creator>
      <dc:date>2021-02-03T21:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for text the includes single quote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/716684#M221533</link>
      <description>&lt;OL&gt;
&lt;LI&gt;Missing semicolon to end query (in red below)&lt;/LI&gt;
&lt;LI&gt;SQL needs a QUIT, not a RUN (orange/purple below). Remove the RUN and leave the QUIT in and that should be good.&lt;/LI&gt;
&lt;/OL&gt;
&lt;PRE&gt;PROC sql;
	create table target as
	select
		*
	from 
		source
	where
		value = "Tom's Trucks" &lt;FONT size="6" color="#FF0000"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt;
	&lt;FONT size="4" color="#FF6600"&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/FONT&gt;
&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#800080"&gt;run;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/367674"&gt;@sutzig&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good evening:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm stuck creating a proc sql statement filtering for a value that includes a single quote (').&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC sql;
	create table target as
	select
		*
	from 
		source
	where
		value = "Tom's Trucks"
	quit;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks for your help.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 22:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/716684#M221533</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-03T22:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for text the includes single quote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/717070#M221729</link>
      <description>&lt;P&gt;Reeza:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for pointing out the syntax error in the sample, but this is not the issue. The issue is creating a filter using a text value criteria which includes a single quote (and, presumably double quotes).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC sql;
	create table target as
	select
		*
	from 
		source
	where
		value in=("Tom's Trucks" ; "Carstop");
	quit;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;will only return records for Carstop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 14:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/717070#M221729</guid>
      <dc:creator>sutzig</dc:creator>
      <dc:date>2021-02-05T14:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for text the includes single quote</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/717075#M221731</link>
      <description>&lt;P&gt;Please provide an example of data where you are having trouble filtering.&amp;nbsp; (Note in your example you have mistakenly added an equal sign and typed a semi-colon instead of comma between the quoted list of values.)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table target as
  select *
  from source
  where value in ("Tom's Trucks" , "Carstop")
;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also since this is SQL code are you perhaps not running that WHERE clause in SAS but have actually pushed it into some remote database that has a different understanding of the meaning of double quote and single quotes?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 14:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filtering-for-text-the-includes-single-quote/m-p/717075#M221731</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-02-05T14:29:13Z</dc:date>
    </item>
  </channel>
</rss>

