<?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: [Q] How to make a Custom RTF footnote with page numbers in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551761#M7411</link>
    <description>&lt;P&gt;1) Why is footnote line broken and displayed as 2 lines ?&lt;/P&gt;
&lt;P&gt;2) The footnote is displayed immediately after the table-text, without space lines&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;to bring the footnote to the last line of the page.&lt;/P&gt;
&lt;P&gt;3) Is the footnote the same that should be in production ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next code works but you may find some issues as a result of above notes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let txt1 = Source Data: ;  /* unique string to search for footnote */

%let txt = \f2 ;            /* rtf control to strat show text - in this RTF format */

data _NULL_;
  retain pages 0 ;
  infile flat(test_rtf.rtf) truncover end=eof;  /* adapt to RTF file created by SAS */
  length a_line $400 text $60;
  input a_line $char400.;
  if index(a_line,"&amp;amp;txt1") then pages+1;
  if eof then call symput('pages',strip(pages));
run;

data _NULL_;
  retain pages pageno 0 ;
  pages = symget('pages');
  infile flat(test_rtf.rtf) truncover end=eof;  /* adapt to RTF file created by SAS */
  length a_line $400 new_line $400 text $60;
  input a_line $char400.;
  
  if index(a_line,"&amp;amp;txt1") then do;
     pageno+1; 
     ix1 = find(a_line,"&amp;amp;txt"||" ");
     ix2 = find(substr(a_line,ix1+3),"&amp;amp;txt"||" ") + ix1;
     put ix1= ix2=;
     if ix1 then text = substr(a_line,ix1); else text='';
     file log;
     if ix1 then put _N_=  pageno= text=;
     new_line = substr(a_line,1,ix2 +4) || put(pageno,2.) || '/' || 
                put(pages,2.) || " pages " || substr(a_line,ix2);
     put new_line=;                    /* for test only */
  end;
  else new_line = a_line;&lt;BR /&gt;
  file flat(new_rtf.rtf);                   /* adapt to new RTF file changed */
  put new_line ;
  
  if eof then put pages= ;
run;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Apr 2019 14:54:35 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2019-04-17T14:54:35Z</dc:date>
    <item>
      <title>[Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551607#M7406</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;First time posting!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, for my first question:&lt;/P&gt;&lt;P&gt;For one of our client, I had to make tables and listing (statistics) in RTF.&lt;/P&gt;&lt;P&gt;However, that client needed a specific format for the output. Instead of having the footnote simply put at the "footnote" area on the page, he needs to have it as close to the table end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;A "classic" output would be&lt;/P&gt;&lt;PRE&gt;______________________________________________________

title

------------------------------------------------------

Var1 | Var2 | ... | Varn

------------------------------------------------------

Results...
&lt;BR /&gt;&lt;BR /&gt;

------------------------------------------------------





Footnote (program name, page x of y)
______________________________________________________&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, what I need is:&lt;/P&gt;&lt;PRE&gt;______________________________________________________

title

------------------------------------------------------

Var1 | Var2 | ... | Varn

------------------------------------------------------

Results...&lt;BR /&gt;&lt;BR /&gt;


------------------------------------------------------
Footnote (program name, page x of y)





______________________________________________________

&lt;/PRE&gt;&lt;P&gt;With SAS Base 9.3, a colleague made for us a vb script that actually renumber the pages.&lt;/P&gt;&lt;P&gt;However, now we are switching to SAS Studio 3.8, that workaround is not valid anymore.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm therefore looking for another way to do that output.&lt;/P&gt;&lt;P&gt;Note that a team member managed to move the footnote itself right under the table, but still the page numbers are not created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are using ODS RTF and proc report, with a macro to initialize the page.&lt;/P&gt;&lt;P&gt;But I'm open to any other suggestion to solve this (installing a MS Office on the App Server is not an option, of course)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Lionel&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 07:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551607#M7406</guid>
      <dc:creator>LionelD</dc:creator>
      <dc:date>2019-04-17T07:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551613#M7407</link>
      <description>&lt;P&gt;1)&amp;nbsp;Read that .rtf file asa text file, search for New Line control character or for the footnote,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; in order to count total number of pages and assign it to a macro variable.&lt;/P&gt;
&lt;P&gt;2) Reread the file, search for the footnote and add page number and the total pages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; check the control character or are there many space lines preceding the footnot&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; and adjust it to be immediate after the&amp;nbsp; results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 07:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551613#M7407</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-04-17T07:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551624#M7408</link>
      <description>Hi,&lt;BR /&gt;Thanks for your quick reply.&lt;BR /&gt;By any chance, would you have a sample code that I could test that does what you are suggesting ?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot in advance.</description>
      <pubDate>Wed, 17 Apr 2019 08:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551624#M7408</guid>
      <dc:creator>LionelD</dc:creator>
      <dc:date>2019-04-17T08:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551639#M7409</link>
      <description>&lt;P&gt;Can you post the .rtf file with at least 3 pages for a test, having the same format as the full one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 10:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551639#M7409</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-04-17T10:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551668#M7410</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Sure, it is T_12.rtf, the file is in attachment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the bottom right corner, under the data, you'll see a "/", that was where my page numbers (x/y) should have theoretically been outputted :-/. but for some unknown reason, I can't number the page&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Lionel&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>Wed, 17 Apr 2019 12:15:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551668#M7410</guid>
      <dc:creator>LionelD</dc:creator>
      <dc:date>2019-04-17T12:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551761#M7411</link>
      <description>&lt;P&gt;1) Why is footnote line broken and displayed as 2 lines ?&lt;/P&gt;
&lt;P&gt;2) The footnote is displayed immediately after the table-text, without space lines&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;to bring the footnote to the last line of the page.&lt;/P&gt;
&lt;P&gt;3) Is the footnote the same that should be in production ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next code works but you may find some issues as a result of above notes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let txt1 = Source Data: ;  /* unique string to search for footnote */

%let txt = \f2 ;            /* rtf control to strat show text - in this RTF format */

data _NULL_;
  retain pages 0 ;
  infile flat(test_rtf.rtf) truncover end=eof;  /* adapt to RTF file created by SAS */
  length a_line $400 text $60;
  input a_line $char400.;
  if index(a_line,"&amp;amp;txt1") then pages+1;
  if eof then call symput('pages',strip(pages));
run;

data _NULL_;
  retain pages pageno 0 ;
  pages = symget('pages');
  infile flat(test_rtf.rtf) truncover end=eof;  /* adapt to RTF file created by SAS */
  length a_line $400 new_line $400 text $60;
  input a_line $char400.;
  
  if index(a_line,"&amp;amp;txt1") then do;
     pageno+1; 
     ix1 = find(a_line,"&amp;amp;txt"||" ");
     ix2 = find(substr(a_line,ix1+3),"&amp;amp;txt"||" ") + ix1;
     put ix1= ix2=;
     if ix1 then text = substr(a_line,ix1); else text='';
     file log;
     if ix1 then put _N_=  pageno= text=;
     new_line = substr(a_line,1,ix2 +4) || put(pageno,2.) || '/' || 
                put(pages,2.) || " pages " || substr(a_line,ix2);
     put new_line=;                    /* for test only */
  end;
  else new_line = a_line;&lt;BR /&gt;
  file flat(new_rtf.rtf);                   /* adapt to new RTF file changed */
  put new_line ;
  
  if eof then put pages= ;
run;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 14:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/551761#M7411</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-04-17T14:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552010#M7414</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Wow, that's a pretty code !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To answer to your questions:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;1) Why is footnote line broken and displayed as 2 lines ?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is the default footnote and It is actually one line, but from client SOP, we had to display this default footnote as :&lt;/P&gt;&lt;P&gt;the "first" part of the default footnote is the "Source Data : Listings^nL_[...].sas" left justified, then it is added to "Data Version[...]" center justification, and finally Table name with date and time of run plus the page number over all pages "T_[...].sas DDMMMYYYY hh:mm x/y". This footnote is "footnote1"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After that default footnote, we has as many footnotes as necessary with a limit of 10, starting from footnote2.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;3) Is the footnote the same that should be in production ?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The production footnote is the same, yes. This is for tables. For listing, the "Source Data" part is removed.&lt;/P&gt;&lt;P&gt;For the tables, we use:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let SList = Source Data: Listings %sysfunc(Strip(&amp;amp;Source_Listing));
%let foot1 = j=l "&amp;amp;SList" j=c "Data Version: &amp;amp;dataver,  &amp;amp;datadate   "  j=r "   &amp;amp;prog_name..sas    &amp;amp;runTime    ^{thispage}/^{lastpage}";
footnote1 &amp;amp;foot1. ; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For the listings, we use:&lt;/P&gt;&lt;PRE&gt;%let foot1 = j=c "Data Version: &amp;amp;dataver,  &amp;amp;datadate   "  j=r "   &amp;amp;prog_name..sas    &amp;amp;runTime    ^{thispage}/^{lastpage}";
footnote1 &amp;amp;foot1. ; &lt;/PRE&gt;&lt;P&gt;Then we add the rest of the footnotes, with a loop, to set footnote2 to footnote10 if relevant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still wonder if the missing page number has something to do with the template ? I don't see anything wrong.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO set_ods_rtf(outPath=,tfl_name=,adDsn=, Source_Listing=, option=bodytitle, startpage=YES);&lt;BR /&gt;ods path(prepend) work.templat(update);

proc template ;
 define style newstyle ;
  parent = styles.journal ;
  class Parskip /
      font = fonts("headingFont")
      cellpadding = 0 cellspacing = 0  /* Only for Measured */
      frame= void
      Rules = NONE
      BorderWidth = 0
      Color = _undef_
      BackGroundColor = _undef_;
  style byline                          / font_face="Courier New" font_style=Roman background = white;
  style Body from Document              / font_face="Courier New" font_style=Roman background = white;
  style data                            / font_face="Courier New" font_style=Roman  ;
  style table                           / font_face="Courier New" font_style=Roman 
                                          bordercolor=black background = white borderwidth=1 ;
  style cellcontents                    / font_face="Courier New" font_style=Roman  ;
  style TitleAndNoteContainer           / font_face="Courier New" font_style=Roman  background = white;
  style ProcTitle                       / font_face="Courier New" font_style=Roman  ;
  style systemtitle                      / font_face="Courier New" font_style=Roman  ;
  style rowheader from headersandfooters / font_face="Courier New" font_style=Roman  ;
  style BodyDate                         / font_face="Courier New" font_style=Roman  ;
  style PageNo                           / font_face="Courier New" font_style=Roman ;
  style SysTitleAndFooterContainer       / font_face="Courier New" font_style=Roman ;
  style header from headersandfooters    / font_face="Courier New" font_style=Roman  background = white;
  style SystemFooter                     / font_face="Courier New" font_style=Roman bordercolor=black background = white borderwidth=1 ;
  style NoteContent                      / font_face="Courier New" font_style=Roman font_size=8pt;
 end;
run ;

/*** Set ODS Environment ***/

options papersize=letter leftmargin=3.65cm rightmargin=2.11cm topmargin=3.36cm bottommargin=3.3cm orientation=landscape;
%if %qupcase(%superq(option))=%quote(TAGSETS) %then %do;
   ods tagsets.rtf file="&amp;amp;outPath.\&amp;amp;tfl_name..rtf" options(vspace='no') options(continue_tag="no") startpage=&amp;amp;startpage.;
   ods tagsets.rtf style=newstyle ;
%end; %else %do;
   ods rtf file="&amp;amp;outPath.\&amp;amp;tfl_name..rtf" &amp;amp;option  startpage=&amp;amp;startpage.;
   ods rtf style=newstyle ;
%end;
options nonumber nocenter nobyline nodate formdlim='' formchar="|_---|+|---+=|-/\&amp;lt;&amp;gt;*" MISSING=" " ;
ods escapechar='^' ;&lt;BR /&gt;%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Another workaround was to use a macro i build with a colleague sometimes ago to force a page break after a certain number of lines, which ultimately gave us also a theoretical page number, it worked for a time. But it is not flawless...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm gonna read the code and test it right away. I'll let you know &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 06:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552010#M7414</guid>
      <dc:creator>LionelD</dc:creator>
      <dc:date>2019-04-18T06:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552029#M7415</link>
      <description>&lt;P&gt;Just some more notes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) To analyze the RTF file as is I used NOTEPAD++ program.&lt;/P&gt;
&lt;P&gt;2) I assumed that the footnote appears only once per page, thus counting number of footnotes&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; is same as counting pages.&lt;/P&gt;
&lt;P&gt;3) You may drop FILE LOG and the PUT lines to log, as it served for debug only.&lt;/P&gt;
&lt;P&gt;4) I found in the RTF file, that you sent, that each text is preceeded by "\f2 ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; It may change across different RTF formats.&lt;/P&gt;
&lt;P&gt;5) I am not familiar enough, neither with RTF formats nor with SAS ODS and STYLE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; So may be there is some other solutions to your request.&lt;/P&gt;
&lt;P&gt;6) When you define the macro variables (%let ...) - they are case sensitive.&lt;/P&gt;
&lt;P&gt;7) You have not specified where, in the footnote, you want the page number, the total number of pages&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; and in what format to display them (how many digits ? 2/5 or 2 / 5 or p.2 / 5 ...).&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Shall it override some spaces or be inserted in the footnote line ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; That will influence how to assign the NEW_LINE statement.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; I understand that the footnotes of a table differ from footnotes of listing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Are they both in &lt;U&gt;&lt;STRONG&gt;same&lt;/STRONG&gt; &lt;/U&gt;RTF file ? That may affect searching for the footnote and counting pages.&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, 18 Apr 2019 08:42:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552029#M7415</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-04-18T08:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552032#M7416</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Just some more notes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) To analyze the RTF file as is I used NOTEPAD++ program.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Oh, thanks, I'm not familiar RTF that much. I was sure that was as complicated as Word.&lt;/P&gt;&lt;P&gt;I indeed found \loch\f2 preceding the place where I need the page number to be placed.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;2) I assumed that the footnote appears only once per page, thus counting number of footnotes&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; is same as counting pages.&lt;/P&gt;&lt;P&gt;3) You may drop FILE LOG and the PUT lines to log, as it served for debug only.&lt;/P&gt;&lt;P&gt;4) I found in the RTF file, that you sent, that each text is preceeded by "\f2 ".&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; It may change across different RTF formats.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You mean tagsets.rtf and ods rtf ? Yes, i'll generate both and search for the appropriate tag.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;5) I am not familiar enough, neither with RTF formats nor with SAS ODS and STYLE.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; So may be there is some other solutions to your request.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;That solution suits me very well, it is fast and actually more reliable than the workaround in vbs from one of my colleage.&lt;/P&gt;&lt;P&gt;Thanks a lot again !&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;6) When you define the macro variables (%let ...) - they are case sensitive.&lt;/P&gt;&lt;P&gt;7) You have not specified where, in the footnote, you want the page number, the total number of pages&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; and in what format to display them (how many digits ? 2/5 or 2 / 5 or p.2 / 5 ...).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Shall it override some spaces or be inserted in the footnote line ?&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; That will influence how to assign the NEW_LINE statement.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, Sorry, the page number should be after the run date and time at the extreme right. To solve that, I've added a keyword to look for, such as **pagenumber** and replaced it by "pagno/pages".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot again for your help. I was not aware of those possibilities.&lt;/P&gt;&lt;P&gt;I very much appreciate, you just saved me a lot of pain ^^ !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Lionel.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 08:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552032#M7416</guid>
      <dc:creator>LionelD</dc:creator>
      <dc:date>2019-04-18T08:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552078#M7417</link>
      <description>&lt;P&gt;By entering the string&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;**pagenumber**&lt;/SPAN&gt;&lt;/STRONG&gt;&amp;nbsp;into the footnote, code can be simplified into:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let pagex = **pagenumber**  ;  /* unique string to search for footnote */

data _NULL_;
  retain pages 0 ;
  infile flat(test_rtf.rtf) truncover end=eof;  /* adapt to RTF file created by SAS */
  length a_line $400;
  input a_line $char400.;
  if index(a_line,"&amp;amp;pagex") then pages+1;
  if eof then call symput('pages',strip(pages));
run;

data _NULL_;
  retain pages pageno 0 ;
  pages = symget('pages');
  infile flat(test_rtf.rtf) truncover end=eof;  /* adapt to RTF file created by SAS */
  length a_line $400 ;
  input a_line $char400.;
  
  ix1 = index(a_line,"&amp;amp;pagex");
  if ix1 then do;
     pageno+1; 
     substr(a_line,ix1,length(&amp;amp;pagex)) = put(pageno,2.) || '/' || put(pages,2.);
  end;
  file flat(new_rtf.rtf);                   /* adapt to new RTF file changed */
  put a_line ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Apr 2019 12:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552078#M7417</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-04-18T12:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: [Q] How to make a Custom RTF footnote with page numbers</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552106#M7418</link>
      <description>&lt;P&gt;The solution was actually much simpler than I expected at first &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks you for your help ! It works at the perfection!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 13:39:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Q-How-to-make-a-Custom-RTF-footnote-with-page-numbers/m-p/552106#M7418</guid>
      <dc:creator>LionelD</dc:creator>
      <dc:date>2019-04-18T13:39:41Z</dc:date>
    </item>
  </channel>
</rss>

