<?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 Ampersand in file name, causing problems in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187192#M265746</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to read in a file with an ampersand in it's name. Please see the code below for an example of what i'm trying to do (simplified the fields obviously).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Notworking&lt;/P&gt;&lt;P&gt;infile "C:\Test this\Csv Files\&amp;amp;csvfile."&amp;nbsp;&amp;nbsp; dlm=','&amp;nbsp; lrecl=10 dsd;&lt;/P&gt;&lt;P&gt;length varnumcsv 3. name $1.;&lt;/P&gt;&lt;P&gt;input name $;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;varnumCSV=_n_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;The problem is the macro variable &amp;amp;Csvfile.&amp;nbsp; is a macro that is defined as the name of a csv file within a directory, during this loop it resolves too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let csvfile=P&amp;amp;I ARREARAGE_brandonsfile.csv;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2028&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;csvfile.;&lt;/P&gt;&lt;P&gt;WARNING: Macro variable "&amp;amp;I" was not resolved&lt;/P&gt;&lt;P&gt;WARNING: Macro variable "&amp;amp;I" was not resolved&lt;/P&gt;&lt;P&gt;P&amp;amp;I ARREARAGE_brandonsfile.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to mask the &amp;amp; from WITHIN the macro variable, so that it doesnt' try to resolve the macro &amp;amp;I at run time (instead treats it JUST as a string). I am not sure how to do this. I know this is probably a simple solution so sorry for its simplicity.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jun 2014 22:19:10 GMT</pubDate>
    <dc:creator>Anotherdream</dc:creator>
    <dc:date>2014-06-05T22:19:10Z</dc:date>
    <item>
      <title>Ampersand in file name, causing problems</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187192#M265746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to read in a file with an ampersand in it's name. Please see the code below for an example of what i'm trying to do (simplified the fields obviously).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Notworking&lt;/P&gt;&lt;P&gt;infile "C:\Test this\Csv Files\&amp;amp;csvfile."&amp;nbsp;&amp;nbsp; dlm=','&amp;nbsp; lrecl=10 dsd;&lt;/P&gt;&lt;P&gt;length varnumcsv 3. name $1.;&lt;/P&gt;&lt;P&gt;input name $;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;varnumCSV=_n_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;The problem is the macro variable &amp;amp;Csvfile.&amp;nbsp; is a macro that is defined as the name of a csv file within a directory, during this loop it resolves too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let csvfile=P&amp;amp;I ARREARAGE_brandonsfile.csv;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2028&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put &amp;amp;csvfile.;&lt;/P&gt;&lt;P&gt;WARNING: Macro variable "&amp;amp;I" was not resolved&lt;/P&gt;&lt;P&gt;WARNING: Macro variable "&amp;amp;I" was not resolved&lt;/P&gt;&lt;P&gt;P&amp;amp;I ARREARAGE_brandonsfile.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to mask the &amp;amp; from WITHIN the macro variable, so that it doesnt' try to resolve the macro &amp;amp;I at run time (instead treats it JUST as a string). I am not sure how to do this. I know this is probably a simple solution so sorry for its simplicity.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 22:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187192#M265746</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2014-06-05T22:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ampersand in file name, causing problems</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187193#M265747</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;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 9pt;"&gt; csvfile=&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: blue; font-size: 9pt;"&gt;%nrstr&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; background: white; color: black; font-size: 9pt;"&gt;(P&amp;amp;I ARREARAGE_brandonsfile.csv);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 23:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187193#M265747</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2014-06-05T23:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Ampersand in file name, causing problems</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187194#M265748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or pop single quotes around it:&lt;/P&gt;&lt;P&gt;%let csvfile='P&amp;amp;I ARREARAGE_brandonsfile.csv';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 09:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187194#M265748</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-06-06T09:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ampersand in file name, causing problems</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187195#M265749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was actually able to solve this using the "%superq(Macrovariablename)"&amp;nbsp; trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't really put single quotes around the variable because the string is deffined WITHIN a macro variable, and therefore it is trying to resolve before the single quotes are defined.&amp;nbsp; Thanks for the tips tho!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 21:48:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ampersand-in-file-name-causing-problems/m-p/187195#M265749</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2014-06-06T21:48:28Z</dc:date>
    </item>
  </channel>
</rss>

