<?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: Issues with quotes in a string. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800523#M314947</link>
    <description>&lt;P&gt;There's nothing wrong with your program. It produces a SAS dataset with the LIBNAME statement as you wanted it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How are you exporting it to a text file? It must be your exporting process that is causing the problem.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 01:42:17 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2022-03-07T01:42:17Z</dc:date>
    <item>
      <title>Issues with quotes in a string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800516#M314941</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm facing issues with the below double quote.&amp;nbsp;I want my dataset to export the below libname as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LIBNAME ABC "&amp;amp;MYPATH./data/temp";&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;But when it gets exported to a text file it appears as below with extra double quotes marked in red.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;"&lt;/FONT&gt;LIBNAME ABC "&lt;FONT color="#FF0000"&gt;"&lt;/FONT&gt;&amp;amp;MYPATH./data/temp&lt;FONT color="#FF0000"&gt;"&lt;/FONT&gt;";&lt;FONT color="#FF0000"&gt;"&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;How do i get rid of these extra double quotes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the code that generates this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA SQF; LENGTH SQL_STRING $500; STOP; RUN;&lt;BR /&gt;%MACRO INSERT_TEXT(ATEXT);&lt;BR /&gt;PROC SQL; INSERT INTO SQF(SQL_STRING) VALUES (&amp;amp;ATEXT.);&lt;BR /&gt;%MEND INSERT_TEXT;&lt;BR /&gt;%INSERT_TEXT('LIBNAME ABC "&amp;amp;MYPATH./data/temp";');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 00:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800516#M314941</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2022-03-07T00:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with quotes in a string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800523#M314947</link>
      <description>&lt;P&gt;There's nothing wrong with your program. It produces a SAS dataset with the LIBNAME statement as you wanted it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How are you exporting it to a text file? It must be your exporting process that is causing the problem.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 01:42:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800523#M314947</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-03-07T01:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with quotes in a string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800524#M314948</link>
      <description>Using the below for exporting.&lt;BR /&gt;	PROC EXPORT DATA=SQF&lt;BR /&gt;	    OUTFILE="&amp;amp;EXPORT_FILE_NAME."&lt;BR /&gt;	    DBMS=TAB&lt;BR /&gt;	    REPLACE;&lt;BR /&gt;	RUN;</description>
      <pubDate>Mon, 07 Mar 2022 01:50:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800524#M314948</guid>
      <dc:creator>aj34321</dc:creator>
      <dc:date>2022-03-07T01:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with quotes in a string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800622#M315004</link>
      <description>&lt;P&gt;I believe the issue you're facing is due to how you pass your parameter:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1646651828091.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69214i2D22EF9B3A4D88F0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1646651828091.png" alt="Patrick_0-1646651828091.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Because the outer quotes are single quotes macro variable &amp;amp;mypath won't resolve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here two options that should you get around this issue.&lt;/P&gt;
&lt;P&gt;Option one - outer quotes are double quotes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mypath=/home/user;
DATA SQF; 
  LENGTH SQL_STRING $500; 
  STOP; 
RUN;
%MACRO INSERT_TEXT(ATEXT);
  PROC SQL; 
    INSERT INTO SQF(SQL_STRING) VALUES (&amp;amp;ATEXT.)
    ;
  quit;
%MEND INSERT_TEXT;
%INSERT_TEXT("LIBNAME ABC '&amp;amp;MYPATH./data/temp';");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Options two - outer quoting within the macro&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mypath=/home/user;
DATA SQF; 
  LENGTH SQL_STRING $500; 
  STOP; 
RUN;

%MACRO INSERT_TEXT(ATEXT);
  PROC SQL; 
    INSERT INTO SQF(SQL_STRING) VALUES (%tslit(&amp;amp;ATEXT.))
    ;
  quit;
%MEND INSERT_TEXT;
%INSERT_TEXT(LIBNAME ABC "&amp;amp;MYPATH./data/temp";);

proc print data=sqf;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the 2nd option with the %TSLIT() macro has the advantage that you can pass the parameter with single or double quotes. The %TSLIT() macro will then take care to get the rest of the quoting "right".&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO INSERT_TEXT(ATEXT);
  PROC SQL; 
    INSERT INTO SQF(SQL_STRING) VALUES (%tslit(&amp;amp;ATEXT.))
    ;
  quit;
%MEND INSERT_TEXT;
%INSERT_TEXT(LIBNAME ABC "&amp;amp;MYPATH./data/temp";);
%INSERT_TEXT(LIBNAME ABC 'home/user/data/temp';);

proc print data=sqf;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1646652279153.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69215iDDA8E1203B213D6C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1646652279153.png" alt="Patrick_0-1646652279153.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 11:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800622#M315004</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-03-07T11:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with quotes in a string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800641#M315010</link>
      <description>&lt;P&gt;To create a delimited file that can be parsed any value that contains the delimiter must be enclosed in quotes.&amp;nbsp; That also requires that any quotes also be enclosed in quotes.&amp;nbsp; If you don't want the strings quoted then do not write them to a delimited file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are just writing text to a file why are you using PROC EXPORT?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set SQF;
  file "&amp;amp;EXPORT_FILE_NAME.";
  put sqf;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Mar 2022 15:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issues-with-quotes-in-a-string/m-p/800641#M315010</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-07T15:30:40Z</dc:date>
    </item>
  </channel>
</rss>

