<?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 using a macros parameter in an ODS statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-a-macros-parameter-in-an-ODS-statement/m-p/29598#M5599</link>
    <description>Hi &lt;BR /&gt;
&lt;BR /&gt;
I am trying to create a macro that will allow me to produce a box plot and save it as a (.rtf) file using ODS. I want to define the directory to which the file will be saved as a macro parameter. But I am having problems with this step.&lt;BR /&gt;
&lt;BR /&gt;
I have created the SAS program first (below) and it works&lt;BR /&gt;
&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods rtf file='c:\data\Boxplot.rtf';&lt;BR /&gt;
proc sort data = register;&lt;BR /&gt;
by type;&lt;BR /&gt;
proc boxplot data=register;&lt;BR /&gt;
plot sbp*type;&lt;BR /&gt;
run;&lt;BR /&gt;
ods rtf close;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
However when I create the macro  I am having problems defining the directory path as a macro parameter. I have tried different formats to define the ODS directory path in the marco using the parameter (one example below) . However I keep receiving  log error that the directory does not exist.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro graphics(parm1);&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods rtf file= &amp;amp;parm1 'Boxplot.rtf';&lt;BR /&gt;
proc sort data = register;&lt;BR /&gt;
by type;&lt;BR /&gt;
proc boxplot data=register;&lt;BR /&gt;
plot sbp*type;&lt;BR /&gt;
run;&lt;BR /&gt;
ods rtf close;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
%mend graphics;&lt;BR /&gt;
&lt;BR /&gt;
%graphics(c:\data\);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I assume I am not using the macro parameter correctly. Any suggestions would be appreciated.&lt;BR /&gt;
&lt;BR /&gt;
cheers, Alistair

Message was edited by: Alby</description>
    <pubDate>Tue, 01 Jun 2010 02:50:03 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-06-01T02:50:03Z</dc:date>
    <item>
      <title>using a macros parameter in an ODS statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-a-macros-parameter-in-an-ODS-statement/m-p/29598#M5599</link>
      <description>Hi &lt;BR /&gt;
&lt;BR /&gt;
I am trying to create a macro that will allow me to produce a box plot and save it as a (.rtf) file using ODS. I want to define the directory to which the file will be saved as a macro parameter. But I am having problems with this step.&lt;BR /&gt;
&lt;BR /&gt;
I have created the SAS program first (below) and it works&lt;BR /&gt;
&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods rtf file='c:\data\Boxplot.rtf';&lt;BR /&gt;
proc sort data = register;&lt;BR /&gt;
by type;&lt;BR /&gt;
proc boxplot data=register;&lt;BR /&gt;
plot sbp*type;&lt;BR /&gt;
run;&lt;BR /&gt;
ods rtf close;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
However when I create the macro  I am having problems defining the directory path as a macro parameter. I have tried different formats to define the ODS directory path in the marco using the parameter (one example below) . However I keep receiving  log error that the directory does not exist.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro graphics(parm1);&lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods rtf file= &amp;amp;parm1 'Boxplot.rtf';&lt;BR /&gt;
proc sort data = register;&lt;BR /&gt;
by type;&lt;BR /&gt;
proc boxplot data=register;&lt;BR /&gt;
plot sbp*type;&lt;BR /&gt;
run;&lt;BR /&gt;
ods rtf close;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
%mend graphics;&lt;BR /&gt;
&lt;BR /&gt;
%graphics(c:\data\);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I assume I am not using the macro parameter correctly. Any suggestions would be appreciated.&lt;BR /&gt;
&lt;BR /&gt;
cheers, Alistair

Message was edited by: Alby</description>
      <pubDate>Tue, 01 Jun 2010 02:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-a-macros-parameter-in-an-ODS-statement/m-p/29598#M5599</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-01T02:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: using a macros parameter in an ODS statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-a-macros-parameter-in-an-ODS-statement/m-p/29599#M5600</link>
      <description>You are very close.  Just a couple of things:&lt;BR /&gt;
1) Double quotes must be used to surround macro variables that appear inside of quoted strings.&lt;BR /&gt;
2) The &amp;amp;PARM1 is part of the path and as such must be quoted.  &lt;BR /&gt;
The ODS statement becomes:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods rtf file= "&amp;amp;parm1\Boxplot.rtf";&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Art</description>
      <pubDate>Tue, 01 Jun 2010 03:42:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-a-macros-parameter-in-an-ODS-statement/m-p/29599#M5600</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-06-01T03:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: using a macros parameter in an ODS statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-a-macros-parameter-in-an-ODS-statement/m-p/29600#M5601</link>
      <description>Thanks Art. That worked.&lt;BR /&gt;
&lt;BR /&gt;
Cheers, Alistair</description>
      <pubDate>Tue, 01 Jun 2010 05:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-a-macros-parameter-in-an-ODS-statement/m-p/29600#M5601</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-01T05:27:58Z</dc:date>
    </item>
  </channel>
</rss>

