<?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 macro for proc sql with single and double quotes,error in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203173#M50704</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like you are accessing and SQL Server database using pass-through.&amp;nbsp; Why not use one SQL to extract all the data into SAS, then have your code filtering the data as it appears in SAS, otherwise you are calling the ODBC interface each time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Jun 2015 09:45:33 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-06-11T09:45:33Z</dc:date>
    <item>
      <title>Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203168#M50699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to do following in macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select * from table1 where col1 like 'x%'&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro temp(val=x);&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select * from table1 where col1 like '&amp;amp;val%';&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that to resolve the value of val, it has to be in double quotes(" ") , but sql statement works only with single quotes(' '), as it throws the error with double quotes: Invalid column name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion how to resolve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 06:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203168#M50699</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-06-11T06:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203169#M50700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The double quotes should work just fine in Proc SQL, since SAS accepts either single or double quote. You are missing a semicolon at the end of the SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to go with the single quotes, you can use the %TSLIT() autocall macro like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; temp(val=&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;A&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;)&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from sashelp.class where name like %&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #000000; background-color: #ffffff;"&gt;tslit&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(&amp;amp;val%);&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp; quit;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;%mend&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;%&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #000000; background-color: #ffffff;"&gt;temp&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(val=A)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 06:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203169#M50700</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2015-06-11T06:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203170#M50701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, the semi-colon was missing by mistake here. Seems like %tslit is doing the job as expected. But not sure why double quotes throws the error: Invalid column name, even if i directly pull the data, using double quotes. I am using SQL server 2008, and query is in SAS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 08:30:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203170#M50701</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-06-11T08:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203171#M50702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you post the SAS log it is easier to see what is going on&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 08:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203171#M50702</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2015-06-11T08:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203172#M50703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt; SELECT scope_id,scope_desc from ops_scope where scope_desc like "Lialda%";&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: CLI describe error: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Lialda%'. : [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above statement works fine with single quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 09:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203172#M50703</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-06-11T09:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203173#M50704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like you are accessing and SQL Server database using pass-through.&amp;nbsp; Why not use one SQL to extract all the data into SAS, then have your code filtering the data as it appears in SAS, otherwise you are calling the ODBC interface each time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 09:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203173#M50704</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-06-11T09:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203174#M50705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;%macro temp(val=x);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %local quotedVal;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %let quotedVal = %str(%')&amp;amp;val%nrstr(%%%');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from table1 where col1 like %unquote(&amp;amp;quotedVal); /* %superq(quotedVal) would cause SQL syntax Error! */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options mprint;&lt;/P&gt;&lt;P&gt;%temp(val=x);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 10:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203174#M50705</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2015-06-11T10:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203175#M50706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have had the same problem...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro temp(val=x);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from table1 where col1 like "%QOUTE(%%)&amp;amp;val.%";&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 10:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203175#M50706</guid>
      <dc:creator>JakobHommelhoff</dc:creator>
      <dc:date>2015-06-11T10:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203176#M50707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="814511" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; (You mean this statement creating problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to odbc as mycon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; (datasrc=cdom3_ops);&lt;/P&gt;&lt;P&gt;create table scope_table as&lt;/P&gt;&lt;P&gt;select * from connection to mycon(SELECT scope_id,scope_desc from ops_scope where scope_desc like "Lialda%");&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not much familiar with database interfacing, but this is what we usually do to connect to SQL server.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 10:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203176#M50707</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-06-11T10:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203177#M50708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The query you posted appears to be reading from the SAS dataset WORK.OPS_SCOPE.&amp;nbsp; So why are you getting an error message from the SQL Server Driver?&lt;/P&gt;&lt;P&gt;Is WORK.OPS_SCOPE a view?&amp;nbsp; How is the view defined?&lt;/P&gt;&lt;P&gt;Most likely what you actually ran was a passthu&amp;nbsp; query more like:&lt;/P&gt;&lt;P&gt;connect to odbc (....). as X ;&lt;/P&gt;&lt;P&gt;select * from connection to X (select scopeid from ops_scope where scope_desc like "XXX") ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case the code that you send to the SQL Server needs to use SQL Server syntax and not SAS syntax.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 10:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203177#M50708</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-11T10:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203178#M50709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="2431" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; OPS_SCOPE is a view. So, i think thats why its SQL server syntax.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 10:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203178#M50709</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-06-11T10:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203179#M50710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So how is the view defined?&lt;/P&gt;&lt;P&gt;I just tried making a view to a table in Teradata server and calling it with a view and SAS happily translated my double quotes to single quotes for me.&lt;/P&gt;&lt;P&gt;libname td teradata ..... ;&lt;/P&gt;&lt;P&gt;proc sql ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create view myview as select * from td.mytable ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select * from myview where myvar like "mystr%" ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 10:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203179#M50710</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-11T10:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203180#M50711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the point I was trying to make was to extract the data into SAS without any restrictions:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sql;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;connect to odbc as mycon&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; (datasrc=cdom3_ops);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;create table scope_table as&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;select * from connection to mycon(SELECT scope_id,scope_desc from ops_scope);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Now you can do one of two things, either in the SAS part of the query put the where - this would be if thats the only data you want to work on in SAS:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sql;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;connect to odbc as mycon&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; (datasrc=cdom3_ops);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;create table scope_table as&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;select * from connection to mycon(SELECT scope_id,scope_desc from ops_scope)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;where &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;scope_desc like "Lialda%"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The where is then executed in SAS.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Alternatively, just keep the full dataset, and where off into a separate table in SAS, that way if you wanted other data, you wouldn't have to do the query again as all the data is in SAS.&amp;nbsp; It really depends on if you need the other data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 11:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203180#M50711</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-06-11T11:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203181#M50712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is weird . Your code should be work.&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #353535; font-family: Lato, sans-serif; font-size: 14px;"&gt;&lt;/P&gt;&lt;H3&gt;Code: Program&lt;/H3&gt;&lt;DIV class="sce-html-export" style="font-family: 'Courier New', Menlo, 'Lucida Console';"&gt;&lt;PRE class="sce-render" style="font-family: 'Courier New', Menlo, 'Lucida Console'; font-size: 16px;"&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;data&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;table1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;col1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'xdw'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;y1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;2&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;output&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;col1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'ddw'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;y1&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="numeric" style="color: #008080; font-weight: bold;"&gt;2&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;output&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="sec-keyword" style="color: #000080; font-weight: bold;"&gt;run&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="macro-sec-keyword" style="color: #000080; font-weight: bold;"&gt;%macro&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;temp&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;val&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;x&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;select&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;*&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;table1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;where&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;col1&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;eqt&lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN class="text" style="color: black;"&gt;symget&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string" style="color: #800080;"&gt;'val'&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="keyword" style="color: #0000ff;"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="macro-sec-keyword" style="color: #000080; font-weight: bold;"&gt;%mend&lt;/SPAN&gt;&lt;SPAN class="sep" style="color: black;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="text" style="color: black;"&gt;%temp&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;SPAN class="text" style="color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 11:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203181#M50712</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-06-11T11:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203182#M50713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not sure how view is defined, but&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;%&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #000000; background-color: #ffffff;"&gt;tslit macro function stated above, seems to be doing the job for me.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 12:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203182#M50713</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-06-11T12:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203183#M50714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got your point. But if it happens to be large data, it would be waste of space and even take lot time, while i need only specific matching rows.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 12:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203183#M50714</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-06-11T12:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203184#M50715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just did a search for documentation on the %tslit macro and didn't find any. Someone point out where this is documented. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 12:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203184#M50715</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-06-11T12:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203185#M50716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can also just make your own macro to add the single quotes.&amp;nbsp; &lt;A __default_attr="11204" __jive_macro_name="document" class="jive_macro jive_macro_document active_link" href="https://communities.sas.com/" modifiedtitle="true" title="Not All Macro Language Elements Are Supported by the Macro Facility"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 13:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203185#M50716</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-11T13:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro for proc sql with single and double quotes,error</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203186#M50717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's a SAS 9.4 autocall macro, &lt;A href="http://support.sas.com/kb/25/076.html" title="http://support.sas.com/kb/25/076.html"&gt;25076 - Resolve a macro variable within single quotation marks&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 13:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-for-proc-sql-with-single-and-double-quotes-error/m-p/203186#M50717</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2015-06-11T13:07:21Z</dc:date>
    </item>
  </channel>
</rss>

