<?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: Saving dataset within a macro where the name is flexible in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Saving-dataset-within-a-macro-where-the-name-is-flexible/m-p/458058#M284490</link>
    <description>&lt;P&gt;You need to put double quotes around macro variables to get them to resolve:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;   outfile&lt;SPAN class="token operator"&gt;="&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;F:\data\EUR_USD_201517_&amp;amp;secs.sec.csv"&lt;/SPAN&gt; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Apr 2018 09:28:35 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-04-27T09:28:35Z</dc:date>
    <item>
      <title>Saving dataset within a macro where the name is flexible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-dataset-within-a-macro-where-the-name-is-flexible/m-p/458051#M284489</link>
      <description>&lt;P&gt;Hi Commuity,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a very simple problem you can probably easily resolve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following macro:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Interval(secs);

data forexExport;
set want7;
minutestime = floor(seconds_time/(&amp;amp;secs.));
run;

data forexExport;
  set forexExport;
  by minutestime;
  if last.minutestime;   
run;

data forexExport;
set forexExport;
log_price = log(RateBid + (RateAsk - RateBid)/2);
run;

proc export data=work.forexExport 
   outfile='F:\data\EUR_USD_201517_&amp;amp;secs.sec.csv'  &amp;lt;- ERRONEOUS LINE
   dbms=csv
   replace;
run;


%mend;

%Interval(900);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the issues lies in the outfile statement (marked with an arrow for you). What it is supposed to do is take the input variable, which in this case is set to 900 and use is within the filename. After exporting, it should basically read &lt;CODE&gt;"EUR_USD_201517_900sec". &lt;FONT face="arial,helvetica,sans-serif"&gt;What it does read instead is "EUR_USD_201517_&amp;amp;secs.sec" so what I used to reference within the macro. I am new to sas so I have trouble finding the issue with my referencing.&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thank you very much in advance!&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Best wishes&lt;/FONT&gt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 09:10:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-dataset-within-a-macro-where-the-name-is-flexible/m-p/458051#M284489</guid>
      <dc:creator>NewSASuser2018</dc:creator>
      <dc:date>2018-04-27T09:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Saving dataset within a macro where the name is flexible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-dataset-within-a-macro-where-the-name-is-flexible/m-p/458058#M284490</link>
      <description>&lt;P&gt;You need to put double quotes around macro variables to get them to resolve:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;   outfile&lt;SPAN class="token operator"&gt;="&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;F:\data\EUR_USD_201517_&amp;amp;secs.sec.csv"&lt;/SPAN&gt; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2018 09:28:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-dataset-within-a-macro-where-the-name-is-flexible/m-p/458058#M284490</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-27T09:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Saving dataset within a macro where the name is flexible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Saving-dataset-within-a-macro-where-the-name-is-flexible/m-p/458066#M284491</link>
      <description>Thank you very much!</description>
      <pubDate>Fri, 27 Apr 2018 09:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Saving-dataset-within-a-macro-where-the-name-is-flexible/m-p/458066#M284491</guid>
      <dc:creator>NewSASuser2018</dc:creator>
      <dc:date>2018-04-27T09:49:30Z</dc:date>
    </item>
  </channel>
</rss>

