<?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: PROC export - dynamic file name in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590156#M23297</link>
    <description>&lt;P&gt;The macro language is just a text replacement system, so you will have the text&lt;/P&gt;
&lt;PRE&gt;put(int_frrpt, $intmaj.)&lt;/PRE&gt;
&lt;P&gt;inserted where you use &amp;amp;schl.:&lt;/P&gt;
&lt;PRE&gt;Output\Profile_&amp;amp;schl._&lt;/PRE&gt;
&lt;P&gt;thus turns into&lt;/P&gt;
&lt;PRE&gt;Output\Profile_put(int_frrpt, $intmaj.)_&lt;/PRE&gt;
&lt;P&gt;and since data step functions are not executed in this place, you end up with the text that surprises you.&lt;/P&gt;
&lt;P&gt;Also, you could only resolve the &lt;EM&gt;text&lt;/EM&gt; "int_frrpt", but never the contents of a variable called int_frrpt.&lt;/P&gt;
&lt;P&gt;Change your %let to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let schl = %sysfunc(putc(&amp;amp;school.,$intmaj.)); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2019 18:50:22 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-09-19T18:50:22Z</dc:date>
    <item>
      <title>PROC export - dynamic file name</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590153#M23296</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset has 18 schools in total. I have a macro written to output .rtf files by school.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like the macro to generate an automated file name for each school, for instance:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Profile_School of Business_&amp;amp;SYSDATE9.rtf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Profile_School of Engineering_&amp;amp;SYSDATE9.rtf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But instead, this happened:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Profile_put(int_frrpt, $intmaj.)_19SEP2019.rtf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;My code:&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;PRE&gt;proc format;
value $intmaj 
'BUS'='School of Business' 
'ENGI'='School of Engineering';
run;

%macro Run_Tabulate2 (school=);
ODS RESULTS OFF;
options orientation=landscape NODATE NOSTIMER NONUMBER NOBYLINE;
%let schl = put(int_frrpt, $intmaj.); 

ods rtf file="&amp;amp;root.\Output\Profile_&amp;amp;schl._&amp;amp;SYSDATE9..rtf" startpage=no BODYTITLE_AUX cssstyle="&amp;amp;root.\style.css";

ods escapechar='^';

proc tabulate;
** Insert misc stats by school here;
run;
ods rtf close;
%mend;

%Run_Tabulate2 (school='BUS'); &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 18:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590153#M23296</guid>
      <dc:creator>lin39</dc:creator>
      <dc:date>2019-09-19T18:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC export - dynamic file name</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590156#M23297</link>
      <description>&lt;P&gt;The macro language is just a text replacement system, so you will have the text&lt;/P&gt;
&lt;PRE&gt;put(int_frrpt, $intmaj.)&lt;/PRE&gt;
&lt;P&gt;inserted where you use &amp;amp;schl.:&lt;/P&gt;
&lt;PRE&gt;Output\Profile_&amp;amp;schl._&lt;/PRE&gt;
&lt;P&gt;thus turns into&lt;/P&gt;
&lt;PRE&gt;Output\Profile_put(int_frrpt, $intmaj.)_&lt;/PRE&gt;
&lt;P&gt;and since data step functions are not executed in this place, you end up with the text that surprises you.&lt;/P&gt;
&lt;P&gt;Also, you could only resolve the &lt;EM&gt;text&lt;/EM&gt; "int_frrpt", but never the contents of a variable called int_frrpt.&lt;/P&gt;
&lt;P&gt;Change your %let to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let schl = %sysfunc(putc(&amp;amp;school.,$intmaj.)); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 18:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590156#M23297</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-19T18:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC export - dynamic file name</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590163#M23298</link>
      <description>&lt;P&gt;Thanks so much for the explanation. However when I tried to used your code, I got&amp;nbsp;&lt;STRONG&gt;Profile_'BUS'_19SEP2019.rtf. &lt;/STRONG&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 19:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590163#M23298</guid>
      <dc:creator>lin39</dc:creator>
      <dc:date>2019-09-19T19:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: PROC export - dynamic file name</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590172#M23300</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80070"&gt;@lin39&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks so much for the explanation. However when I tried to used your code, I got&amp;nbsp;&lt;STRONG&gt;Profile_'BUS'_19SEP2019.rtf. &lt;/STRONG&gt;Any ideas?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does the format actually know how to decode the value 'BUS' instead of BUS?&amp;nbsp; If not then don't include the single quotes in the value of the macro variable.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 19:45:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590172#M23300</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-19T19:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC export - dynamic file name</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590186#M23304</link>
      <description>&lt;P&gt;Since the macro processor is a&amp;nbsp;&lt;EM&gt;text&lt;/EM&gt; processor only, quotes are almost never needed. Change your macro call to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Run_Tabulate2(school=BUS);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Sep 2019 20:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-export-dynamic-file-name/m-p/590186#M23304</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-19T20:11:38Z</dc:date>
    </item>
  </channel>
</rss>

