<?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: SAS Macro: I need to put single quotes around the macro variable to use in a filename statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900457#M355869</link>
    <description>&lt;P&gt;But you can get all this much easier:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename CSV_In "&amp;amp;csv_detail_type";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;without any intermediate DATA step.&lt;/P&gt;</description>
    <pubDate>Sat, 28 Oct 2023 20:10:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-10-28T20:10:03Z</dc:date>
    <item>
      <title>SAS Macro: I need to put single quotes around the macro variable to use in a filename statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900454#M355866</link>
      <description>&lt;P&gt;I have %let statements that get combined to give a file location.&lt;/P&gt;
&lt;P&gt;I want to use that macro variable as the file location in a filename statement. The problem is I need single quotes around the value of the macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;options mprint symbolgen linesize=132;&lt;/DIV&gt;
&lt;DIV&gt;%let Storage_system = 30689;&lt;/DIV&gt;
&lt;DIV&gt;%let CSV_Data = z:\mainframe\GPSE\SNCR\CF_Reports\CSV\;&lt;/DIV&gt;
&lt;DIV&gt;%let Report_Type = Cacheinfo;&lt;/DIV&gt;
&lt;DIV&gt;%let CSV_Detail_Type = &amp;amp;CSV_Data&amp;amp;Report_Type..csv;&lt;/DIV&gt;
&lt;DIV&gt;%put 'CSV_Detail file is': &amp;amp;CSV_Detail_Type;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;data _null_;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; quoted_type = catx("'",&amp;amp;CSV_Detail_Type,"'");&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; call symput(Quoted_CSV,quoted_type);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;filename CSV_In &amp;amp;Quoted_CSV;&lt;/DIV&gt;
&lt;DIV&gt;The macro variable CSV_Detail_Type resolves correctly, minus quote marks.&lt;/DIV&gt;</description>
      <pubDate>Sat, 28 Oct 2023 19:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900454#M355866</guid>
      <dc:creator>lchristensen</dc:creator>
      <dc:date>2023-10-28T19:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro: I need to put single quotes around the macro variable to use in a filename statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900456#M355868</link>
      <description>&lt;P&gt;You don't need to use the function, but double quotes to make a string literal out of the macro variable:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;quoted_type = "'&amp;amp;CSV_Detail_Type'";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The outer double quotes prevent the single quotes from masking the macro variable.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2023 20:06:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900456#M355868</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-10-28T20:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro: I need to put single quotes around the macro variable to use in a filename statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900457#M355869</link>
      <description>&lt;P&gt;But you can get all this much easier:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename CSV_In "&amp;amp;csv_detail_type";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;without any intermediate DATA step.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2023 20:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900457#M355869</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-10-28T20:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro: I need to put single quotes around the macro variable to use in a filename statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900467#M355874</link>
      <description>&lt;P&gt;Why do you need single quotes?&amp;nbsp; Is there some other code you are trying to generate than the FILENAME statement?&lt;/P&gt;
&lt;PRE&gt;1    %let CSV_Data = z:\mainframe\GPSE\SNCR\CF_Reports\CSV\;
2    %let Report_Type = Cacheinfo;
3    %let CSV_Detail_Type = &amp;amp;CSV_Data.&amp;amp;Report_Type..csv;
4    %put &amp;amp;=csv_detail_type ;
CSV_DETAIL_TYPE=z:\mainframe\GPSE\SNCR\CF_Reports\CSV\Cacheinfo.csv
5
6    filename CSV_In "&amp;amp;csv_detail_type" ;
7
8    %put %sysfunc(pathname(csv_in));
z:\mainframe\GPSE\SNCR\CF_Reports\CSV\Cacheinfo.csv
&lt;/PRE&gt;
&lt;P&gt;If do you want to quote a string of unknown value don't just add quotes on either end.&amp;nbsp; Use the QUOTE() function.&amp;nbsp; That will properly double up any quotes that are already in the string.&lt;/P&gt;
&lt;PRE&gt;1    %let mvar=He said "Hello" to me.;
2    %put %sysfunc(quote(&amp;amp;mvar));
"He said ""Hello"" to me."
3    %put %sysfunc(quote(&amp;amp;mvar,%str(%')));
'He said "Hello" to me.'

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Oct 2023 23:11:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900467#M355874</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-10-28T23:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro: I need to put single quotes around the macro variable to use in a filename statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900476#M355878</link>
      <description>&lt;P&gt;Try this one :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let CSV_Data = z:\mainframe\GPSE\SNCR\CF_Reports\CSV\;
%let Report_Type = Cacheinfo;
%let CSV_Detail_Type = %bquote('&amp;amp;CSV_Data&amp;amp;Report_Type..csv');
%put 'CSV_Detail file is': &amp;amp;CSV_Detail_Type;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1698570792049.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/89187i249ECD8F08BDE118/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1698570792049.png" alt="Ksharp_0-1698570792049.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2023 09:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900476#M355878</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-10-29T09:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro: I need to put single quotes around the macro variable to use in a filename statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900493#M355886</link>
      <description>&lt;P&gt;&amp;nbsp;Thank you. I tried lots of combinations and thought I had tried that with the result being it didn't substitute the value of the macro variable and instead had put the macro variable (&amp;amp;CSV_Detail_Type) in quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But tried this and it worked fine.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2023 14:28:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900493#M355886</guid>
      <dc:creator>lchristensen</dc:creator>
      <dc:date>2023-10-29T14:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro: I need to put single quotes around the macro variable to use in a filename statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900494#M355887</link>
      <description>&lt;P&gt;Thank you. That works too.&lt;/P&gt;
&lt;P&gt;I must be losing my mind because I really think I tried this yesterday too.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2023 14:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-I-need-to-put-single-quotes-around-the-macro-variable/m-p/900494#M355887</guid>
      <dc:creator>lchristensen</dc:creator>
      <dc:date>2023-10-29T14:33:55Z</dc:date>
    </item>
  </channel>
</rss>

