BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASuserlot
Barite | Level 11

Hi all,

I am a weird  situation where I have 11 Titles and footnotes goes to 16 lines (  because of  string lengths).  Is any efficient way to write them specially footnotes. any inputs or article links greatly appreciated. I wan to make sure there is a line above the first footnote.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Titles and Footnotes for RTF documents go into the header/footer portion of the document page. That is the default behavior that can be overridden with the BODYTITLE option.

 

If the text does not need to go into that header then Proc ODSTEXT may be sufficient. A very brief example:

proc odstext;
p "Some text on the left"/style=[just=L];
p "Some centered text" / style=[just=C];
p "Some text right justified"/ style=[just=R];
run;

I am not sure I follow your concern about 138 unless you mean the OPTIONS LINESIZE=138 is somehow impacting our output. The RTF Title and Footnote would wrap depending on fontsize and papersize definition (plus possible interaction with other ODS settings). Any text long enough will wrap in RTF when it exceeds the available space. 

 

Proc ODSTEXT can also use a data set for creating the text, or the Proc ODSLIST may be more appropriate. One of the nice things about  these two procedures is that you do not have to have any other procedure involved to write text, unlike Title and Footnote. The P statement I use above is for paragraph and starts a block of text that can extend for multiple lines or force the start of a new line with the P statement.

View solution in original post

10 REPLIES 10
ballardw
Super User

Do these lines of text have to behave exactly like Title/Footnote statements? If so, you should specify the specific ODS destination. Consider that by default Title/Footnote go into the Header/Footer section of RTF files. Duplicating that behavior for something else may be a bit tricky.

 

Line length should wrap so counting a wrapped line as a title statement might not be the way to go.

Example of a long title that wraps itself:

proc print data=sashelp.class noobs label;
title "This is a really long text for use in a title statement with proc print and ABCdeefffgggxxst string content
  including a line break in typing the title statement";
run;title;

I would suggest providing the code you are currently using to create these titles/footnotes.

Is the "line above the footnote" supposed be part of the footnote? or the end of a table? something else?

SASuserlot
Barite | Level 11

This is the code; I commented the title and footnotes which are more than 10  to run the program. but I need them( title 11,foonote 11 and 12)

options orientation = landscape errors = 2 missing = ' ' nofmterr ls = 175 validvarname = upcase nofmterr nobyline;

data class;
set sashelp.class;
col1= name;
col2= sex;
col3= age;
col4= height;
col5= weight;
run;

ods escapechar = '^';
ods noresults; 
ods listing close; 
ods rtf file = "C:\Users\xx\Desktop\Newfolder\class.rtf"  style = table_rtf; 
proc report data =class ls = 145 ps = 55  missing nowindows split='|'
	         headskip headline    
	         style(report)=[bordertopcolor=black bordertopwidth=2] style(header)=[asis=on just=c vjust=t fontweight=bold 
							font_face= "Times New Roman" background=white borderbottomcolor=black fontsize=9pt];  

	** titles **;
	title1 j = l "School";
	title2 j = l "Deparment";
	title3 j = l "class";
	title4 j = c "Incharge";
	title5 j = c "Group";
	title6 j = c "&sysdate9";
	title7 j = l "&systime";
	title8 j = l "Datacut";
	title9 j = l "Absent";
	title10 j = l "Project";
/*	title11 j=c "project title";*/
	** report **;
	column  (("First Name ^R/RTF'\brdrb\brdrs\li100\ri100' " col1 col2)("Statistics ^R/RTF'\brdrb\brdrs\li100\ri100' " col3-col5));
									

	define col1		/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Name"			 ;
	define col2 	/group order = internal style(header) = [just=l] 	 style(column) = [just=l vjust=b cellwidth=10% asis=on]"Sex";
	define col3     /group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Age"	;
	define col4 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Height"			;
	define col5 	/group order = internal style(header) = [just=c] 	 style(column) = [just=c vjust=b cellwidth=10% asis=on]"Weight ";

compute before/style(lines)={asis=on just=l};
line '              xxxxxxxxxxxxx                                yyyyyyyyyyyyyyyyyy';
endcomp;
compute after col1;
line @1'    xsds xsds';
endcomp;
footnote1 j = l"#R/RTF'\brdrt\brdrs 'Do these lines of text have to behave exactly like Title/Footnote statements? If so, you should specify the specific ODS destination." ;
footnote2 j = l "Consider that by default Title/Footnote go into the Header/Footer section of RTF files. Duplicating that behavior for something else may be a bit tricky. line legth should wrap so counting a wrapped line as a ttle statement might not be the way to go";
footnote3 j = l	"Often you might want to perform postselection analysis by using other SAS procedures. To facilitate this, PROC GLMSELECT saves the";
footnote4 j = l "note:The following table describes the macro variables that PROC GLMSELECT creates. Note that when BY processing is used, one macro";
footnote5 j = l	"note:...........................................";
footnote6 j = l "note:To facilitate this, PROC GLMSELECT saves the list of selected effects in a macro variable. This list does not explicitly include the intercept so that you can use it in the MODEL statement of other SAS/STAT regression procedures.";
footnote7 j = l "note:...........................................";
footnote8 j = l "note:...........................................";
footnote9 j = l "note:...........................................";
footnote10 j = l "note:...........................................";
/*footnote11 j= l "note:To aid in associating indexed macro variables with the appropriate observations when BY processing is used, PROC GLMSELECT creates a variable _BY_ in the output data set specified in an OUTPUT statement ";*/
/*footnote12 j=l "You can now leverage these macro variables and the output data set created by PROC GLMSELECT to perform postselection analyses that match the selected models with the appropriate BY-group observations. ;*/
run;
ods rtf close;
ods listing close;

to include in my rtf output.

ChrisNZ
Tourmaline | Level 20

This works:

ods escapechar = '^';
ods rtf file = "&wdir\class.rtf"  ; 
title j=left "Do these lines of text have to ^n behave exactly like Title/Footnote statements? ^n If so, you should specify the specific ODS destination." ;
proc print data =SASHELP.CLASS ;run;

ChrisNZ_0-1606768210264.png

 

SASuserlot
Barite | Level 11
I believe that works. but how about foonotes when you have the long text you expecting to count the number of characters and place "^n" in footnotes. seems this will increase amount work
ChrisNZ
Tourmaline | Level 20

SAS offers 10 titles. If you want more, you have to split them. That's the only way.

ballardw
Super User

You did not answer if the behavior of going into the document header/footer is needed.

 

 

SASuserlot
Barite | Level 11
I am sorry, what you mean by the title behaviour? I provided the code I am expecting to get exactly what its in the title and footnotes like justifications. however for footnotes if the string length greater than ( i believe 138 ) then it has to print in the following line in order to avoid the warning in the log. and if any footnote starts with the new line it has to be start with new line.
ballardw
Super User

Titles and Footnotes for RTF documents go into the header/footer portion of the document page. That is the default behavior that can be overridden with the BODYTITLE option.

 

If the text does not need to go into that header then Proc ODSTEXT may be sufficient. A very brief example:

proc odstext;
p "Some text on the left"/style=[just=L];
p "Some centered text" / style=[just=C];
p "Some text right justified"/ style=[just=R];
run;

I am not sure I follow your concern about 138 unless you mean the OPTIONS LINESIZE=138 is somehow impacting our output. The RTF Title and Footnote would wrap depending on fontsize and papersize definition (plus possible interaction with other ODS settings). Any text long enough will wrap in RTF when it exceeds the available space. 

 

Proc ODSTEXT can also use a data set for creating the text, or the Proc ODSLIST may be more appropriate. One of the nice things about  these two procedures is that you do not have to have any other procedure involved to write text, unlike Title and Footnote. The P statement I use above is for paragraph and starts a block of text that can extend for multiple lines or force the start of a new line with the P statement.

SASuserlot
Barite | Level 11

Thanks. It's do the job for me. Thanks again for quick solution.

SASuserlot
Barite | Level 11

Just one more question for my knowledge. how come we pring 12 footnotes, and each footnote has to start in different line. 

Example:

footnote 1 Modifying Titles and/or Footnotes to correct misspellings or to include additional explanations that
could not have been anticipated until the data was unblinded 

imagine there are 11 more footnotes of same length and each footnote has to start with "modifying..."

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 10 replies
  • 2943 views
  • 3 likes
  • 3 in conversation