<?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: Get the value of a macro variable into a BOX in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425151#M281088</link>
    <description>&lt;P&gt;HI Cynthia,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your inputs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will give what exactly my requirement is,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I have a data set with 100 subjects and 5 variables.&lt;/P&gt;&lt;P&gt;2. For each subject I have to display a separate RTF file with the actual data as per data set in the format that you gave in the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; previous&amp;nbsp;reply. Also For ex: if there is any field, lets assume&amp;nbsp;'Start date' is one&amp;nbsp;of the fields and for a specific subject&amp;nbsp;start date is&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Null, we should&amp;nbsp;not&amp;nbsp;get that row at all in the rtf file.&lt;/P&gt;&lt;P&gt;3. At last, I have another Excel input where we get reviewer comments in it in a single cell and it could be very lengthy. I have to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; append those comments to the respective RTF file subject wise with&amp;nbsp;a neat text alignment and borders to it (Comments should be With in a BOX at the end of the RTF file for each subject with proper format).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me on this requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hari&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jan 2018 06:26:23 GMT</pubDate>
    <dc:creator>Hari2</dc:creator>
    <dc:date>2018-01-05T06:26:23Z</dc:date>
    <item>
      <title>Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424875#M281081</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a lengthy comment getting into a macro variable from an external text file. Now, I am just writing the value of macro variable into a rtf file using PUT statement .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The&amp;nbsp;requirement is, I need to&amp;nbsp;&amp;nbsp;align the data properly and also it should fit in a box. Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 11:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424875#M281081</guid>
      <dc:creator>Hari2</dc:creator>
      <dc:date>2018-01-04T11:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424879#M281082</link>
      <description>&lt;P&gt;Examples?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are two parts here, first importing the data from the text file into a SAS dataset.&amp;nbsp; I assume that is fine from your side?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next is outputting to the RTF file, is there a reason you cannot use proc report - as that has border controls, alignment and such like built in, would make life a lot easier?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or is it for a title, if so you can apply styles also to that.&amp;nbsp; Without some information its really hard to guess.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 11:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424879#M281082</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-04T11:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424887#M281083</link>
      <description>&lt;P&gt;Thanks for reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing some data (specific columns for each subject which are&amp;nbsp;fetched from a dataset into macro variables)&amp;nbsp;already through PUT statement into a external RTF file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At last I have to append Comments (This value I will fetch it from a different file into a macro variable). I am trying to write the value from a macro variable using PUT statement after all columns printed through put statements as mentioned above.&lt;/P&gt;&lt;P&gt;for comments value, I need to display with proper alignment with in a box, just to look good. Now&amp;nbsp;since&amp;nbsp;comments value is a lengthy&amp;nbsp;statement and its not&amp;nbsp;getting displayed properly in the RTF file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as you mentioned, we may try to display the macro variable with in TITLE/FOOTNTE statement with styles applied to it. please suggest how can we do this.&amp;nbsp; Just assume a macro variable with lengthy single statement in it as a value and we have to write to a RTF file and the value should be with in box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please consider &amp;amp;comm. has the value, you can see Put "&amp;amp;comm."; in the code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; AEDATA();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%DO&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%to&lt;/FONT&gt; &lt;FONT face="Courier New"&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;&lt;FONT color="#008080"&gt;&amp;amp;total.&lt;/FONT&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _NULL_;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;file &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"XXXXXXXXX\testf&amp;amp;i..rtf"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; print&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Title;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;' '&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;PUT &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'SUBECT ID :'&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"&amp;amp;&amp;amp;sub&amp;amp;i."&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%IF&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(length(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"&amp;amp;&amp;amp;aetrm&amp;amp;i."&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)) &amp;gt; &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'AE Term is :'&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"&amp;amp;&amp;amp;aetrm&amp;amp;i."&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%IF&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;(length(&amp;amp;&amp;amp;llt&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;i.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;)) &amp;gt; &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'AE Llt is :'&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"&amp;amp;&amp;amp;llt&amp;amp;i."&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Start date is :'&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"&amp;amp;&amp;amp;stdt&amp;amp;i."&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'*************************'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'*************************'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'*************************'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'*************************'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;put &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"&amp;amp;comm."&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;%END&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;aedata&lt;/I&gt;&lt;/STRONG&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 12:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424887#M281083</guid>
      <dc:creator>Hari2</dc:creator>
      <dc:date>2018-01-04T12:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424891#M281084</link>
      <description>&lt;P&gt;Without seeing any data it is difficult to suggest something, except: don't use macro language if you don't have to. RTF-files can be created by ods rtf, there is hardly any need to do this manually with data steps.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 12:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424891#M281084</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-01-04T12:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424899#M281085</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;has said, its far simpler to use the tools built to generate outputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks to me like your creating some sort of patient profile as a text file.&amp;nbsp; You can achieve the same thing, just get all your data into a dataset and then use proc report - you can add borders, change fonts etc. and with ods rtf create an rtf file from it.&amp;nbsp; Just putting plain text out to a file, you would need to have a good level of RTF tagset knowledge to apply all the relevant tags.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 13:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424899#M281085</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-04T13:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424968#M281086</link>
      <description>&lt;P&gt;Look at PROC ODSTEXT.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 16:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/424968#M281086</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-04T16:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425086#M281087</link>
      <description>&lt;P&gt;Or, in addition to Reeza's suggestion, you could use PROC REPORT to generate something like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="text_in_box.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17655iFF6F3BC5B3A3F1B3/image-size/large?v=v2&amp;amp;px=999" role="button" title="text_in_box.png" alt="text_in_box.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Which was created using ODS RTF with PROC REPORT instead of using PUT statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the sample code -- instead of putting the program in a loop, I just hardcoded values for the macro variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let  sub1 = Lewis Carroll ;
%let  aetrm1 = Term 1 ;
%let  llt1 = Something Else ;
%let  stdt1 = January 4, 2018 ;
%let  comm1= %str(Twas brillig and the slithy toves did gyre and gimble in the wabe. All mimsy were the borogroves and the momeraths outgrabe.);

data comment;
  length linestr $1000;
  infile datalines dlm=',' dsd;
  input linenum linestr $;
  if linenum = 1 then linestr = catx(' ',linestr,"&amp;amp;sub1");
  else if linenum = 3 then linestr = catx(' ',linestr,"&amp;amp;aetrm1");
  else if linenum = 4 then linestr = catx(' ',linestr,"&amp;amp;llt1");
  else if linenum = 5 then linestr = catx(' ',linestr,"&amp;amp;stdt1");
  else if linenum = 7 then linestr = catx(' ',linestr,"&amp;amp;comm1");
return;
datalines;
1,'^{style[fontweight=bold]SUBECT ID:}'  
2,'^{newline 2}'
3,"^{style[fontweight=bold]AE Term is:} "
4,"^{style[fontweight=bold]AE Llt is:}"
5,"^{style[fontweight=bold]Start date is:}"
6,"*************************"
7,"^{style[fontweight=bold]Comment:}"
;
run;

ods escapechar='^';
options nodate number;
title;

ods rtf file="c:\temp\testf1.rtf" style=rtf;

  proc report data=comment noheader
      style(report)={rules=none frame=box cellspacing=0 width=5in};
  column linenum linestr;
  define linenum / order noprint;
  define linestr / display;
  run;

ods rtf close;
 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 22:51:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425086#M281087</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-01-04T22:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425151#M281088</link>
      <description>&lt;P&gt;HI Cynthia,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your inputs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will give what exactly my requirement is,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I have a data set with 100 subjects and 5 variables.&lt;/P&gt;&lt;P&gt;2. For each subject I have to display a separate RTF file with the actual data as per data set in the format that you gave in the&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; previous&amp;nbsp;reply. Also For ex: if there is any field, lets assume&amp;nbsp;'Start date' is one&amp;nbsp;of the fields and for a specific subject&amp;nbsp;start date is&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Null, we should&amp;nbsp;not&amp;nbsp;get that row at all in the rtf file.&lt;/P&gt;&lt;P&gt;3. At last, I have another Excel input where we get reviewer comments in it in a single cell and it could be very lengthy. I have to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; append those comments to the respective RTF file subject wise with&amp;nbsp;a neat text alignment and borders to it (Comments should be With in a BOX at the end of the RTF file for each subject with proper format).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me on this requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hari&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 06:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425151#M281088</guid>
      <dc:creator>Hari2</dc:creator>
      <dc:date>2018-01-05T06:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425231#M281089</link>
      <description>&lt;P&gt;Hi: &lt;BR /&gt;Most of what you describe can be produced by using a Macro program definition. Where I have my %let statements, you would have some kind of looping construct that would cause the program to create 1 RTF file for each of your subjects. That part is fairly straightforward.&lt;BR /&gt;&lt;BR /&gt;Your requirement for suppressing null strings is easily done with IF statements, my program did not get that complicated, but instead of doing a simple CATX, as I show, you could include another test for the value of any line's macro variable to be missing or not. Something like this, if you were going to do your test inside a DATA step:&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;else if linenum = 5 then do;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "&amp;amp;stdt1" = " " then linestr = " ";&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if "&amp;amp;stdt1" gt " " then linestr = catx(' ',linestr,"&amp;amp;stdt1")&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;end;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;or, you might choose to make the test part of the macro code and use the presence or absence of the macro variable to determine the code that was written. That is more of a design approach.&lt;BR /&gt;&lt;BR /&gt;For your question about having the comments in an Excel file, my suggestion would be that there are a couple of ways to deal with this. You could either read the subject file and the comment file separately and merge them together ahead of time (before your loop) so that you have the appropriate comment in the same data file with the subjects -- 100 subjects and 5 variables or 6 variables -- even lengthy strings is not going to be too big to process. Or, you could read the Excel file one time for each subject and extract only the comment you need for that subject inside the loop to produce the RTF file. My tendency would be to use the first approach. I'm a fan of getting all my data organized the way I want before I start a reporting step.&lt;BR /&gt;&lt;BR /&gt; I envision 1 PROC REPORT step if you get all the data organized into 1 dataset. However, if the data is in 2 datasets and you need 2 different reports, then I would envision something like this: &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;** looping structure for each subject;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods rtf file="&amp;amp;&amp;amp;subj&amp;amp;i..rtf" startpage=no;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;** first proc report for main subject information;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;** can use a WHERE statement to restrict the PROC REPORT to one subject;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;** second proc report for information from Excel file, which you will;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;** need to get into a SAS dataset before this step;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;** can also use a WHERE statement to restrict the PROC REPORT to the comment ;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;** for one subject;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods rtf close;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;** end looping structure;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;It really comes down to what you feel comfortable with and what can be maintained over time. For example, you could want 2 types of report -- it's not clear to me what you might want to see produced. Here is an example:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="not_clear.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17664i6C4798A80C03C78C/image-size/large?v=v2&amp;amp;px=999" role="button" title="not_clear.png" alt="not_clear.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 17:46:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425231#M281089</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-01-05T17:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425529#M281090</link>
      <description>Thanks a Lot Cynthia. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Sat, 06 Jan 2018 19:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425529#M281090</guid>
      <dc:creator>Hari2</dc:creator>
      <dc:date>2018-01-06T19:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425531#M281091</link>
      <description>You're welcome! BTW, I'm not entirely sure you need to have extensive macro variables for each subject. I created some fake data for the 2 screen shots and did use a macro program for the looping, but did NOT use macro variables to write the values in the box -- I just used regular DATA set variables in a concatenate. I found I did not really need macro variables.&lt;BR /&gt;&lt;BR /&gt;  And, as others have explained in regard to your other posting about "appending" to an RTF file. It is very, very hard to create an RTF file and then append any addition output to it. It is far easier to have 1 ODS RTF "sandwich" which captures the output from the first procedure or step and then captures the output from the next procedure or step and puts both outputs into 1 ODS RTF file.&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Sat, 06 Jan 2018 20:01:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/425531#M281091</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-01-06T20:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/494732#M281092</link>
      <description>HI Cynthia,&lt;BR /&gt;&lt;BR /&gt;in the above code which you suggested, How to align any specific line in Center.&lt;BR /&gt;ex: I want to keep data in first line in CENTER. please provide which option to use. Please reply as soon as you see this. Thanks in advance.</description>
      <pubDate>Wed, 12 Sep 2018 07:25:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/494732#M281092</guid>
      <dc:creator>Hari2</dc:creator>
      <dc:date>2018-09-12T07:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/494966#M281093</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; Without seeing YOUR code, it's hard to suggest how to center the first line. There were 2 different programs for 2 different reports in my screen shot. Basically, I'd need to do a style override and use JUST=C in the style override. But depending on this example you're asking about, I might make the change in an ODS ESCAPECHAR style override or I might have a style override in a DEFINE statement or might have it in a CALL DEFINE statement.&lt;BR /&gt;&lt;BR /&gt;For the program that I used to make that example back in January, I would have needed a CALL DEFINE because I used a LINENUM variable to identify each string on the report. So in example #2 (on the right), I would have needed to do this:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="how_to_center.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23219i73324DD107F3EDB4/image-size/large?v=v2&amp;amp;px=999" role="button" title="how_to_center.png" alt="how_to_center.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In this example, I used 2 PROC REPORTs to generate the output. The SUBJECT ID: line would need to be centered with a style override in a CALL DEFINE in my program. &lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/494966#M281093</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-09-12T18:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/496519#M281094</link>
      <description>&lt;P&gt;Thanks Cynthia. This is what I was expecting and It was helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One more , I actually used Background color , however its coming entire line in the page. I want to restrict it only to the Text that is available . Could you please suggest how to make it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ex&lt;/STRONG&gt;: My Output should have first line with Heading as "Your Complete Details" aligned Center with some Background color and BG Color should only fit to the Text not the entire Line.&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;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 11:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/496519#M281094</guid>
      <dc:creator>Hari2</dc:creator>
      <dc:date>2018-09-18T11:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get the value of a macro variable into a BOX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/498360#M281095</link>
      <description>Thanks Cynthia. This is what I was expecting and It was helpful.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;One more , I actually used Background color , however its coming entire line in the page. I want to restrict it only to the Text that is available . Could you please suggest how to make it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Ex: My Output should have first line with Heading as "Your Complete Details" aligned Center with some Background color and BG Color should only fit to the Text not the entire Line.&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Sep 2018 11:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-value-of-a-macro-variable-into-a-BOX/m-p/498360#M281095</guid>
      <dc:creator>Hari2</dc:creator>
      <dc:date>2018-09-24T11:31:15Z</dc:date>
    </item>
  </channel>
</rss>

