<?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: Put company name and Page X of Y on the same line NOT using title statement in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286755#M16440</link>
    <description>&lt;P&gt;Hello Ksharp,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help! It seems your approach is working but one more thing I need to consult you. Why you use catx function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am asking because I need more space between the company name and page x of y. I tried larger numbers but it gives me error msg says something like truncation happened. I guess maybe the string is too long.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jul 2016 04:26:59 GMT</pubDate>
    <dc:creator>wtcnb</dc:creator>
    <dc:date>2016-07-25T04:26:59Z</dc:date>
    <item>
      <title>Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286588#M16431</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to PROC REPORT to output a table/listing, and I want to put the company name and Page X of Y in the same line, but NOT using title statement. Because using title statement will put this info in the real "header" section of the output, say, a RTF file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is basically what i need: NOTE: basically all the following info will be in the same "table", especially the first line is also in this "table" not in the RTF "header" section. I appreciate your helps!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Company LP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Page X of Y&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Protocol X&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Table 1: X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Statistics&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; treat&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; coontrol&lt;/P&gt;&lt;P&gt;n&lt;/P&gt;&lt;P&gt;mean&lt;/P&gt;&lt;P&gt;sd&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jul 2016 16:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286588#M16431</guid>
      <dc:creator>wtcnb</dc:creator>
      <dc:date>2016-07-23T16:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286598#M16432</link>
      <description>Hi, what code have you tried? The standard way to achieve page X of Y is to use a TITLE statement and ODS ESCAPECHAR. The way that Page X of Y works is that for RTF, the proper field codes are inserted into the Word doc, and then, at the time the document is opened and rendered in Word, the Page X of Y is given values in Word.&lt;BR /&gt;&lt;BR /&gt;  I don't understand what you mean that "basicaly all the following info will be in the same "table" - -do you mean that your report procedure or program already has the company name and page information? If this is the case, then what about your current process is not working?&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Sat, 23 Jul 2016 19:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286598#M16432</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-23T19:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286599#M16433</link>
      <description>If we use title statement then the page x of y will be in the header section, which is in grey color.&lt;BR /&gt;&lt;BR /&gt;What I want to do is to Not using title statement but line statement to align the company name and page x of y in the same line.&lt;BR /&gt;&lt;BR /&gt;I checked a lot webpages it seems that this is not possible unless we manually add space between company name and page x of y.</description>
      <pubDate>Sat, 23 Jul 2016 19:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286599#M16433</guid>
      <dc:creator>wtcnb</dc:creator>
      <dc:date>2016-07-23T19:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286601#M16434</link>
      <description>The header is only gray because of how Word shows the header when you are in "typing" mode. When you go into Print Preview mode or when you actually print, the header is not gray, it is whatever font color you specify (usually black).&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Sat, 23 Jul 2016 19:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286601#M16434</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-23T19:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286602#M16435</link>
      <description>Hi Cynthia,&lt;BR /&gt;&lt;BR /&gt;Thanks, I know the print version is fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; but I just don't want it to be in the header, actually this is a project for someone who is extremely picky and just wants the company name and page x of y are in the same line and not in the real header section.</description>
      <pubDate>Sat, 23 Jul 2016 19:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286602#M16435</guid>
      <dc:creator>wtcnb</dc:creator>
      <dc:date>2016-07-23T19:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286629#M16436</link>
      <description>&lt;PRE&gt;
Can you use COMPUTE BEFORE _PAGE_ ?



compute before _page_;
line '~S={just=left} Company Name ~S={just=right} ~{thispage} of ~{lastpage}';
endcomp;


&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Jul 2016 03:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286629#M16436</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-24T03:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286630#M16437</link>
      <description>Hi Ksharp,&lt;BR /&gt;&lt;BR /&gt;I copied your codes into my program but it doesn't work, did you try it in your codes?</description>
      <pubDate>Sun, 24 Jul 2016 03:23:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286630#M16437</guid>
      <dc:creator>wtcnb</dc:creator>
      <dc:date>2016-07-24T03:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286655#M16438</link>
      <description>Hi:&lt;BR /&gt;  I do not believe that RTF respects {thispage} or {lastpage} in the body of the document. This would be a question for Tech Support.&lt;BR /&gt;cynthia</description>
      <pubDate>Sun, 24 Jul 2016 13:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286655#M16438</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-24T13:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286747#M16439</link>
      <description>&lt;PRE&gt;
Oh. You need a bunch of code to get it. I can't believe ~{pageof} ,~{thispage},~{lastpage} wouldn't work in the body of RTF.
Why ? How sad it is .

The following is assuming each page of yours contains 29 lines, you can test it to get it . The attachment is what I got .
The full idea is the paper I wrote a couple of years ago .
http://support.sas.com/resources/papers/proceedings12/389-2012.pdf

Good Luck.


data test;
infile datalines expandtabs;
input Manager : $20. Department : $20. Sales ;
datalines;
Adams	Canned	225
Adams	Meat/Dairy	350
Adams	Paper	40
Adams	Produce	80
Alomar	Canned	420
Alomar	Meat/Dairy	190
Alomar	Paper	90
Alomar	Produce	86
Andrews	Canned	420
Andrews	Meat/Dairy	300
Andrews	Paper	200
Andrews	Produce	125
Brown	Canned	230
Brown	Meat/Dairy	250
Brown	Paper	45
Brown	Produce	73
Jones	Canned	220
Jones	Meat/Dairy	300
Jones	Paper	40
Jones	Produce	70
Pelfrey	Canned	420
Pelfrey	Meat/Dairy	205
Pelfrey	Paper	45
Pelfrey	Produce	76
Reveiz	Canned	420
Reveiz	Meat/Dairy	600
Reveiz	Paper	60
Reveiz	Produce	30
Smith	Canned	120
Smith	Meat/Dairy	100
Smith	Paper	50
Smith	Produce	80
Taylor	Canned	120
Taylor	Meat/Dairy	130
Taylor	Paper	53
Taylor	Produce	50
;
run;

/*After testing it, found a page contains 29 lines*/


proc means data=test nway noprint;
 class manager;
 output out=count n=count;
run;
data result;
 merge test count(keep=manager count);
 by manager;
run;
data result;
 set result;
 mod=mod(count,29);
run;
data result; * To decide Page break point;
 set result;
 by manager;
 retain break 1;
 if last.manager then sum_mod+mod;
 if count +sum_mod ge 29 and manager ne lag(manager) then do;
   break+1; sum_mod=0;
 end;
 call symputx('last_page',break);
run; 


ods rtf  file='/folders/myfolders/xx.rtf' style=sasweb bodytitle;
ods escapechar='~';
title 'Desired Report';
option nodate nonumber;
proc report data=result  nowd style={rules=none frame=void};
column break manager department sales ;
define break /group noprint;
define manager / order  order=formatted;
compute before _page_;
 line=catx(' ',"Company ",repeat('~_',40),"Page:",break,"of","&amp;amp;last_page");
 line line $200.; 
endcomp;
break after break /page;
run;
ods rtf close;



&lt;/PRE&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12774i22687BF4777B8F18/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="x.png" title="x.png" /&gt;</description>
      <pubDate>Mon, 25 Jul 2016 02:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286747#M16439</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-25T02:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286755#M16440</link>
      <description>&lt;P&gt;Hello Ksharp,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your help! It seems your approach is working but one more thing I need to consult you. Why you use catx function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am asking because I need more space between the company name and page x of y. I tried larger numbers but it gives me error msg says something like truncation happened. I guess maybe the string is too long.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 04:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286755#M16440</guid>
      <dc:creator>wtcnb</dc:creator>
      <dc:date>2016-07-25T04:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286765#M16441</link>
      <description>&lt;PRE&gt;
Yes. The reason I use CATX() is try to left align COMPANY and right align PAGE OF .
~S={just=left } don't work in this scenario .

Alternative way is :
line=catx(......);
line @1 "Company Name"  @200 line $40.;

&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jul 2016 06:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286765#M16441</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-25T06:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286769#M16442</link>
      <description>&lt;PRE&gt;


data test;
infile datalines expandtabs;
input Manager : $20. Department : $20. Sales ;
datalines;
Adams	Canned	225
Adams	Meat/Dairy	350
Adams	Paper	40
Adams	Produce	80
Alomar	Canned	420
Alomar	Meat/Dairy	190
Alomar	Paper	90
Alomar	Produce	86
Andrews	Canned	420
Andrews	Meat/Dairy	300
Andrews	Paper	200
Andrews	Produce	125
Brown	Canned	230
Brown	Meat/Dairy	250
Brown	Paper	45
Brown	Produce	73
Jones	Canned	220
Jones	Meat/Dairy	300
Jones	Paper	40
Jones	Produce	70
Pelfrey	Canned	420
Pelfrey	Meat/Dairy	205
Pelfrey	Paper	45
Pelfrey	Produce	76
Reveiz	Canned	420
Reveiz	Meat/Dairy	600
Reveiz	Paper	60
Reveiz	Produce	30
Smith	Canned	120
Smith	Meat/Dairy	100
Smith	Paper	50
Smith	Produce	80
Taylor	Canned	120
Taylor	Meat/Dairy	130
Taylor	Paper	53
Taylor	Produce	50
;
run;

/*After testing it, found a page contains 29 lines*/


proc means data=test nway noprint;
 class manager;
 output out=count n=count;
run;
data result;
 merge test count(keep=manager count);
 by manager;
run;
data result;
 set result;
 mod=mod(count,29);
run;
data result; * To decide Page break point;
 set result;
 by manager;
 retain break 1;
 if last.manager then sum_mod+mod;
 if count +sum_mod ge 29 and manager ne lag(manager) then do;
   break+1; sum_mod=0;
 end;
 call symputx('last_page',break);
run; 


ods rtf  file='/folders/myfolders/xx.rtf' style=sasweb bodytitle;
ods escapechar='~';
title 'Desired Report';
option nodate nonumber;
proc report data=result  nowd style={rules=none frame=void};
column break manager department sales ;
define break /group noprint;
define manager / order  order=formatted;
compute before _page_;
 line=catx(' ',"Page:",break,"of","&amp;amp;last_page");
 line @1 "Company" @50 line $40.; 
endcomp;
break after break /page;
run;
ods rtf close;

&lt;/PRE&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12775i143939841F671ECE/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="x.png" title="x.png" /&gt;</description>
      <pubDate>Mon, 25 Jul 2016 06:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286769#M16442</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-25T06:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Put company name and Page X of Y on the same line NOT using title statement</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286775#M16443</link>
      <description>&lt;PRE&gt;

Actually , If you don't care about what I referred to in that paper, That could be a lot more easy .






/*After testing it, found a page contains 29 lines*/

data result; * To decide Page break point;
 set sashelp.cars;
 if mod(_n_,29)=1 then break+1; 
 call symputx('last_page',break);
run; 


ods rtf  file='/folders/myfolders/xx.rtf' style=sasweb bodytitle;
ods escapechar='~';
title 'Desired Report';
option nodate nonumber;
proc report data=result  nowd style={rules=none frame=void};
column break Model Make Length Invoice Cylinders ;
define break /order noprint;

compute before _page_;
 line=catx(' ',"Page:",break,"of","&amp;amp;last_page");
 line @1 "Company" @100 line $40.; 
endcomp;
break after break /page;
run;
ods rtf close;

&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jul 2016 06:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Put-company-name-and-Page-X-of-Y-on-the-same-line-NOT-using/m-p/286775#M16443</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-25T06:46:41Z</dc:date>
    </item>
  </channel>
</rss>

