<?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: Is there a way to add a macro name to filenames in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751301#M29668</link>
    <description>&lt;P&gt;Same answer as this thread from earlier today.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/libname-won-t-call-the-macro-variable/m-p/751254#M236461" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/libname-won-t-call-the-macro-variable/m-p/751254#M236461&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro processor ignores strings bounded on the outside by single quotes.&amp;nbsp; Use double quotes instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS doesn't care which type of quotes you use, but the macro processor does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also do not include the quotes in the value of the macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let FileName =cbpmy20a_detail_regulatory_my20_125591_mrr_medhmo_214372.csv;
filename InovMRR "/sasdata3_MI_projects_hedis_vendor/production/inovalon/data/download/ry2021/MRR/Unprocessed/&amp;amp;Filename.";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If for some reason you did need to have quotes in the value of your macro variable and then use that quoted string as part of a larger quoted string the use %SYSFUNC() macro function to call the QUOTE() function to add the outside quotes and make sure the result is proper SAS syntax.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let FileName ="cbpmy20a_detail_regulatory_my20_125591_mrr_medhmo_214372.csv";
filename InovMRR %sysfunc(quote(/sasdata3_MI_projects_hedis_vendor/production/inovalon/data/download/ry2021/MRR/Unprocessed/&amp;amp;Filename.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that since Unix will ignore the quotes around part of the filename the version using %sysfunc(quote()) should work whether or not the macro variable includes quotes.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jun 2021 16:36:33 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-06-30T16:36:33Z</dc:date>
    <item>
      <title>Is there a way to add a macro name to filenames</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751297#M29666</link>
      <description>&lt;P&gt;Good Day,&lt;/P&gt;&lt;P&gt;Is there a way to add a macro name to filenames. I tried the example below and got an error message that the filename does not exist.&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;&lt;P&gt;%let FileName ="cbpmy20a_detail_regulatory_my20_125591_mrr_medhmo_214372.csv";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename InovMRR '/sasdata3_MI_projects_hedis_vendor/production/inovalon/data/download/ry2021/MRR/Unprocessed/&amp;amp;Filename.';&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751297#M29666</guid>
      <dc:creator>Jesusismygrace</dc:creator>
      <dc:date>2021-06-30T16:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to add a macro name to filenames</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751300#M29667</link>
      <description>&lt;P&gt;1) Macro variables do not resolve inside single quotes.&lt;/P&gt;
&lt;P&gt;2) The . is considered a macro processor "end of variable name". So if you want to use a macro variable before a file extension you need to use two . because the first gets used by the macro processor&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename InovMRR &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;/sasdata3_MI_projects_hedis_vendor/production/inovalon/data/download/ry2021/MRR/Unprocessed/&amp;amp;Filename..csv&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;;&lt;/P&gt;
&lt;P&gt;(or what ever extension the file might have)&lt;/P&gt;
&lt;P&gt;if the macro variable contains the extension then the second dot is not needed. But you may need to watch closely how you make that macro variable.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:24:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751300#M29667</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-30T16:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to add a macro name to filenames</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751301#M29668</link>
      <description>&lt;P&gt;Same answer as this thread from earlier today.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/libname-won-t-call-the-macro-variable/m-p/751254#M236461" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/libname-won-t-call-the-macro-variable/m-p/751254#M236461&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro processor ignores strings bounded on the outside by single quotes.&amp;nbsp; Use double quotes instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS doesn't care which type of quotes you use, but the macro processor does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also do not include the quotes in the value of the macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let FileName =cbpmy20a_detail_regulatory_my20_125591_mrr_medhmo_214372.csv;
filename InovMRR "/sasdata3_MI_projects_hedis_vendor/production/inovalon/data/download/ry2021/MRR/Unprocessed/&amp;amp;Filename.";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If for some reason you did need to have quotes in the value of your macro variable and then use that quoted string as part of a larger quoted string the use %SYSFUNC() macro function to call the QUOTE() function to add the outside quotes and make sure the result is proper SAS syntax.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let FileName ="cbpmy20a_detail_regulatory_my20_125591_mrr_medhmo_214372.csv";
filename InovMRR %sysfunc(quote(/sasdata3_MI_projects_hedis_vendor/production/inovalon/data/download/ry2021/MRR/Unprocessed/&amp;amp;Filename.));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that since Unix will ignore the quotes around part of the filename the version using %sysfunc(quote()) should work whether or not the macro variable includes quotes.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:36:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751301#M29668</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-30T16:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to add a macro name to filenames</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751476#M29685</link>
      <description>Good Day! Thank you for all the help. It worked like a charm</description>
      <pubDate>Thu, 01 Jul 2021 15:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-way-to-add-a-macro-name-to-filenames/m-p/751476#M29685</guid>
      <dc:creator>Jesusismygrace</dc:creator>
      <dc:date>2021-07-01T15:06:38Z</dc:date>
    </item>
  </channel>
</rss>

