<?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 Create file in a macro concatenate number PDF ODS in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302854#M1245</link>
    <description>&lt;P&gt;I'm trying to generate PDF files with diferent namen in each iteration.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code I need is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro x1(i);&lt;/P&gt;&lt;P&gt;ODS PDF FILE='myfolders/&lt;STRONG&gt;newfile_&amp;amp;i';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ODS PDF CLOSE;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro x2(init,end);&lt;/P&gt;&lt;P&gt;%do i=&amp;amp;init %to &amp;amp;end;&lt;/P&gt;&lt;P&gt;x1(&amp;amp;i)&lt;/P&gt;&lt;P&gt;%end&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%x2(1,2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is that I dont know how to update&amp;nbsp;in the name of the new file the number i (&amp;nbsp;&lt;STRONG&gt;newfile_&amp;amp;i';&amp;nbsp;&lt;/STRONG&gt;)&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2016 07:02:56 GMT</pubDate>
    <dc:creator>mariange8282</dc:creator>
    <dc:date>2016-10-06T07:02:56Z</dc:date>
    <item>
      <title>Create file in a macro concatenate number PDF ODS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302854#M1245</link>
      <description>&lt;P&gt;I'm trying to generate PDF files with diferent namen in each iteration.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code I need is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro x1(i);&lt;/P&gt;&lt;P&gt;ODS PDF FILE='myfolders/&lt;STRONG&gt;newfile_&amp;amp;i';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ODS PDF CLOSE;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro x2(init,end);&lt;/P&gt;&lt;P&gt;%do i=&amp;amp;init %to &amp;amp;end;&lt;/P&gt;&lt;P&gt;x1(&amp;amp;i)&lt;/P&gt;&lt;P&gt;%end&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%x2(1,2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is that I dont know how to update&amp;nbsp;in the name of the new file the number i (&amp;nbsp;&lt;STRONG&gt;newfile_&amp;amp;i';&amp;nbsp;&lt;/STRONG&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 07:02:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302854#M1245</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-10-06T07:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create file in a macro concatenate number PDF ODS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302856#M1246</link>
      <description>&lt;P&gt;What do you want the file name to be?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As is it will be&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new_file1&lt;/P&gt;
&lt;P&gt;new_file2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your also missing the extension which make cause issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh...and double quotes not single quotes. Macro variables don't resolve in single quotes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And your second macro is pointless. Loop in your main macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you need a period to let SAS know where the end of the macro variable is.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
%macro x1(init, end);
 
%do I =&amp;amp;unit %to &amp;amp;bend;
ODS PDF FILE="myfolders/newfile_&amp;amp;i..pdf";
 
Title "This is report #&amp;amp;i.";
Proc print data = sashelp.class;
run;
 
ODS PDF CLOSE;
%end;
%mend;
 
 
%x1(1,2)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 06 Oct 2016 07:13:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302856#M1246</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-06T07:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Create file in a macro concatenate number PDF ODS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302865#M1248</link>
      <description>&lt;P&gt;thanks it works perfect!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 07:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302865#M1248</guid>
      <dc:creator>mariange8282</dc:creator>
      <dc:date>2016-10-07T07:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create file in a macro concatenate number PDF ODS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302867#M1249</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105303"&gt;@mariange8282&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;thanks but &amp;amp;i in&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;ODS&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;PDF&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;FILE&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"myfolders/newfile_&amp;amp;i..pdf"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;not change the name, because the program assume that all in "....." is a string and not avaluate the variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is plain wrong.&lt;/P&gt;
&lt;P&gt;If i is present as a macro variable, and has different values, this will work.&lt;/P&gt;
&lt;P&gt;Did you run &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s code as presented, to test the principle?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 08:09:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302867#M1249</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-06T08:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create file in a macro concatenate number PDF ODS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302868#M1250</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105303"&gt;@mariange8282&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;thanks but &amp;amp;i in&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;ODS&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;PDF&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;FILE&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"myfolders/newfile_&amp;amp;i..pdf"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;not change the name, because the program assume that all in "....." is a string and not avaluate the variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand what your saying here.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;1. Does the code run as posted and generate two files?&lt;/P&gt;
&lt;P&gt;2. How does it not meet your requirements. Not a mind reader here. Be explicit.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 08:25:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302868#M1250</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-06T08:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create file in a macro concatenate number PDF ODS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302910#M1252</link>
      <description>&lt;P&gt;Your original post used single quotes, which prevent resolution of macro variables within. &amp;nbsp;The sample solutions use double quotes, which allow that resolution. &amp;nbsp;So that's part of the change you will need to make, switching from single to double quotes.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 11:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302910#M1252</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-06T11:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create file in a macro concatenate number PDF ODS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302951#M1253</link>
      <description>&lt;P&gt;In addition to the issue with single quotes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do i=&amp;amp;init %to &amp;amp;end;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;x1(&amp;amp;i)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;you do not call the X1 macro correctly inside %x2 should be %x1&lt;/P&gt;
&lt;P&gt;%end&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt; No ; to complete the %end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2016 14:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-file-in-a-macro-concatenate-number-PDF-ODS/m-p/302951#M1253</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-06T14:16:15Z</dc:date>
    </item>
  </channel>
</rss>

