<?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: How to output macro variable value in RTF using ODS TEXT in SAS? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971676#M46069</link>
    <description>&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/td-p/971612" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/td-p/971612&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This is just sample data; the grammar may not be correct, and I’m unable to share the original data entry records due to confidentiality. However, the formatting and structure are similar to my actual data.&lt;BR /&gt;&lt;BR /&gt;I need to create a Word document using this data format to share with my client and users. The client wants the data and formatting to be the same as the original.&lt;BR /&gt;&lt;BR /&gt;I have created a stored procedure to generate this document dynamically for the client and users, but the output is not properly formatted and does not match the data exactly.&lt;BR /&gt;</description>
    <pubDate>Wed, 30 Jul 2025 08:33:47 GMT</pubDate>
    <dc:creator>Daily1</dc:creator>
    <dc:date>2025-07-30T08:33:47Z</dc:date>
    <item>
      <title>How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971612#M46061</link>
      <description>&lt;P&gt;I want to read a POLICY Description from a dataset into a macro variable and then print it into an RTF file using &lt;CODE data-start="548" data-end="558"&gt;ODS TEXT&lt;/CODE&gt;, formatted with Times New Roman and 11pt font size.&lt;BR /&gt;&lt;STRONG&gt;Code I Tried&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    select POLICY into :POLICY from sample_data;
quit;

ods text="^S={font_face='Times New Roman' font_size=11pt just=left} &amp;amp;POLICY";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The code runs but I don't see the correct formatting or output in the RTF file. Am I missing something in the &lt;CODE data-start="1202" data-end="1211"&gt;ODS RTF&lt;/CODE&gt; setup?&lt;BR /&gt;&lt;STRONG&gt;PFA&lt;/STRONG&gt;&lt;BR /&gt;Climate Change.docx is i want output&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 09:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971612#M46061</guid>
      <dc:creator>Daily1</dc:creator>
      <dc:date>2025-07-29T09:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971617#M46062</link>
      <description>&lt;P&gt;Posting data as excel-file is not helpful, please post the data as data step using datalines or cards.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the sample_data contains multiple observations, only the value of the first obs will be in &amp;amp;policy.&lt;/P&gt;
&lt;P&gt;You need&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;ods escapechar= "^";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;before using ods text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 10:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971617#M46062</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2025-07-29T10:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971627#M46063</link>
      <description>&lt;P&gt;If you are using PROC IMPORT to import the Excel file, you will need to use a UTF-8 encoded session of SAS. This will preserve the special symbols, but it will not preserve the line breaks. The following worked for me as an example, and then I just added line breaks in the Word file as desired. An alternative would be to hard-code the text using your own ODS TEXT= statements or PROC ODSTEXT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile='your_path\sample data.xlsx'
 out=sample_data dbms=xlsx replace;
run;

/* may need to remove embedded quotes to not conflict with resolving macro variable in double quotes */
data sample_data;
set sample_data;
policy=compress(compress(policy,'"'),"'");
run;

proc sql noprint;
    select POLICY into :POLICY from sample_data;
quit;

%put &amp;amp;policy;

ods listing close;
ods escapechar='^';
ods rtf file='your_path\test.rtf';

ods text="^S={font_face='Times New Roman' font_size=11pt just=left} &amp;amp;POLICY";

proc print data=sashelp.class;
run;

ods rtf close;
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Jul 2025 12:55:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971627#M46063</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-07-29T12:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971646#M46064</link>
      <description>&lt;P&gt;I don't understand.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading the DATA from a cell in an XLSX worksheet will not include any formatting that might be applied to the cell by EXCEL.&amp;nbsp; So what formatting are you talking about?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jul 2025 16:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971646#M46064</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-07-29T16:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971651#M46065</link>
      <description>&lt;P&gt;Can you make an example that we can run, which doesn't require downloading an Excel file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stealing from Kathryn's code, a small example could be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let policy= ; *Fill me in with some value like you have in Excel;

ods listing close;
ods escapechar='^';
ods rtf file='your_path\test.rtf';

ods text="^S={font_face='Times New Roman' font_size=11pt just=left} &amp;amp;POLICY";

proc print data=sashelp.class;
run;

ods rtf close;
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Jul 2025 17:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971651#M46065</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-07-29T17:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971668#M46066</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daily1_0-1753855148858.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108623i220C91F4E77651B4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daily1_0-1753855148858.png" alt="Daily1_0-1753855148858.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I would like to represent this type of database data entry record in my document exactly as it appears&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 06:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971668#M46066</guid>
      <dc:creator>Daily1</dc:creator>
      <dc:date>2025-07-30T06:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971671#M46067</link>
      <description>&lt;P&gt;Afaik this won't work with ods text. Try proc odstext instead.&lt;/P&gt;
&lt;P&gt;Docs:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.5/odsproc/p01vqfrzpxj3bgn1x9elf98takez.htm" target="_blank"&gt;https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.5/odsproc/p01vqfrzpxj3bgn1x9elf98takez.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 06:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971671#M46067</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2025-07-30T06:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971673#M46068</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/236411"&gt;@Daily1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daily1_0-1753855148858.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108623i220C91F4E77651B4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daily1_0-1753855148858.png" alt="Daily1_0-1753855148858.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I would like to represent this type of database data entry record in my document exactly as it appears&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Complete with bad grammar, words split across lines (it is normally considered very bad form to have short words like "the" or"and" split and you have both).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What manipulation is expected to be done to the "data" set that contains this stuff? If none, perhaps SAS shouldn't be involved at all.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 07:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971673#M46068</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-07-30T07:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971676#M46069</link>
      <description>&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/td-p/971612" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/td-p/971612&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This is just sample data; the grammar may not be correct, and I’m unable to share the original data entry records due to confidentiality. However, the formatting and structure are similar to my actual data.&lt;BR /&gt;&lt;BR /&gt;I need to create a Word document using this data format to share with my client and users. The client wants the data and formatting to be the same as the original.&lt;BR /&gt;&lt;BR /&gt;I have created a stored procedure to generate this document dynamically for the client and users, but the output is not properly formatted and does not match the data exactly.&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Jul 2025 08:33:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971676#M46069</guid>
      <dc:creator>Daily1</dc:creator>
      <dc:date>2025-07-30T08:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971734#M46080</link>
      <description>&lt;P&gt;If you have to create a report with complex formatting, have a look at the Report Writing Interface. Most layouts can be created, but this takes time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 04:57:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971734#M46080</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2025-07-31T04:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to output macro variable value in RTF using ODS TEXT in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971741#M46081</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;
&lt;P&gt;Check PROC ODSLIST and PROC ODSTEXT :&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1753941865577.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108649iD548CBEC70486135/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1753941865577.png" alt="Ksharp_0-1753941865577.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_1-1753942001615.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108650i8DB7D756E0F736D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_1-1753942001615.png" alt="Ksharp_1-1753942001615.png" /&gt;&lt;/span&gt;&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;</description>
      <pubDate>Thu, 31 Jul 2025 06:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-output-macro-variable-value-in-RTF-using-ODS-TEXT-in-SAS/m-p/971741#M46081</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-07-31T06:06:53Z</dc:date>
    </item>
  </channel>
</rss>

