BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
RooRoo
Obsidian | Level 7
The problem remained, now I got "Page 1" on the first two pages. But it's interesting, that you don't have this issue.
Cynthia_sas
Diamond | Level 26
Hi: I think that you have to force Word to repaginate the document to get the page numbers adjusted by Word. Word is doing the pagination, SAS is only sending the command for the page. If you don't find that repaginating the Word document helps fix your issue, then I think Tech Support is your next stop.
Cynthia
RooRoo
Obsidian | Level 7
Thanks for your reply!
Could you please tell how to force repagination? I couldn't find anything about it.
Ksharp
Super User

That is really weird. Maybe you need buy a ticket to sas support.

 

About your last question, you can get rid of "Table1...." by using option "contents=" of PROC REPORT.

The attachment is the rtf file I got and no problem as you described.

 

DATA AAA;
	SET SASHELP.CARS;
RUN;
proc sort data=AAA;
by Make;
run;
data AAA;
 set AAA;
 PAGE_NO = FLOOR((_n_-1)/15)+1;
run;




ODS RTF(ID=INDA) FILE= "c:\temp\A.rtf" CONTENTS=YES STARTPAGE=YES TOC_DATA;
PROC REPORT DATA=AAA(obs=100) contents=' ';
	COLUMNS PAGE_NO Make Model Type Origin DriveTrain MSRP Invoice EngineSize Cylinders Horsepower MPG_City MPG_Highway;
	DEFINE PAGE_NO / ORDER NOPRINT contents="";
	DEFINE Make / ORDER NOPRINT;
	DEFINE Model / 		DISPLAY ID STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Type / 		DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Origin / 	DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE DriveTrain / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE MSRP / 		DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Invoice / 	DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN} contents="" PAGE;
	DEFINE EngineSize / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Cylinders / 	DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Horsepower / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE MPG_City / 	DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE MPG_Highway /DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};

	COMPUTE BEFORE Make;
		LINE @1 " ";
		LINE @1 Make $16.;
		LINE @1 " ";
	ENDCOMP;

	break after page_no / page contents=" ";

	compute after _page_;
		line "Some text";
		line "Some other text";
	endcomp;


RUN;
ods text='End of Table';

ODS RTF(ID=INDA) CLOSE;
RooRoo
Obsidian | Level 7
Unfortunately, it didn't held - Table1 is still there.
Ksharp
Super User

Ha. Try this one :

 

%let n=20;   * a page has 20 records ;
DATA AAA;
	SET SASHELP.CARS(obs=100);
RUN;
proc sort data=AAA;
by Make;
run;
data AAA;
 set AAA;
 by Make;
 if first.Make then n=0;
 n+1;
 if first.Make or mod(n,&n.)=1 then PAGE_NO+1;
 drop n;
run;



ODS RTF(ID=INDA) FILE= "c:\temp\A.rtf" CONTENTS=YES STARTPAGE=YES TOC_DATA;
PROC REPORT DATA=AAA contents='';
	COLUMNS  Make PAGE_NO Model Type Origin DriveTrain MSRP Invoice EngineSize Cylinders Horsepower MPG_City MPG_Highway;
	DEFINE Make / ORDER contents="";
    DEFINE PAGE_NO / ORDER NOPRINT contents="";

	DEFINE Model / 		DISPLAY ID STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Type / 		DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Origin / 	DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE DriveTrain / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE MSRP / 		DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Invoice / 	DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN} contents="" PAGE;
	DEFINE EngineSize / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Cylinders / 	DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE Horsepower / DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE MPG_City / 	DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};
	DEFINE MPG_Highway /DISPLAY STYLE(COLUMN)={CELLWIDTH=1IN};

	COMPUTE BEFORE _page_;
		LINE @1 " ";
		LINE @1 Make $16.;
		LINE @1 " ";
	ENDCOMP;

	break before page_no / page contents="";

	compute after _page_;
		line "Some text";
		line "Some other text";
	endcomp;


RUN;
ods text='End of Table';

ODS RTF(ID=INDA) CLOSE;

Ksharp_0-1741943722639.png

 

RooRoo
Obsidian | Level 7
That's a very good one!
Yeah, there's a disadvantage that for a group with few entries there is more empty space on the page, but in all other aspects it's just great!
RooRoo
Obsidian | Level 7
Yes, I tried with STARTPAGE=NO too, but looks like it doesn't work well with DEFINE PAGE option.

And thank you! I will check your other solution as well.
Cynthia_sas
Diamond | Level 26
Hi: Look at this Tech Support note about the Table 1 node in PROC REPORT: https://support.sas.com/kb/31/278.html
Also, regarding your question about forcing repagination in Word I usually just do it by going into Page Preview mode and scrolling to the end of the document and the scrolling back to the top of the document. I believe there is also an F command to do it, but you'd have to look in the Word documentation.
Cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 24 replies
  • 2407 views
  • 12 likes
  • 4 in conversation