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

  My students are using SAS OnDemand for Academics, SAS Studio,

I want to use bodytitle for RTF.

 

I tried, 

ods rtf(web) bodytitle;

and I get the errors below.  I have tried, running ods rtf close first and I still get the same results.  Any ideas?  Is it just not possible?

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74
75 ods rtf(web) bodytitle;
WARNING: BODYTITLE and BODYTITLE_AUX cannot be changed in mid document.
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  This works for me -- using the full control method with FILE= in SAS OnDemand for Academics:

Cynthia_sas_0-1601047641366.png

 

  Here's the code to test -- you will need to make an all_output folder under your main Files (Home) top node.

ods rtf file='~/all_output/trybodytitle.rtf' bodytitle;

  title 'Twas Brillig and the Slithy Toves';
  proc print data=sashelp.class;
  run;
ods rtf close;

The ~ (tilde) is a place holder for your /home folder name. This is /home/<yourUserID> -- but you have to know what your userID is or do a right-click on Files(Home) and choose Properties to find what the path is.

 

Hope this helps,

Cynthia

 

View solution in original post

7 REPLIES 7
ballardw
Super User

@LauraRK wrote:

  My students are using SAS OnDemand for Academics, SAS Studio,

I want to use bodytitle for RTF.

 

I tried, 

ods rtf(web) bodytitle;

and I get the errors below.  I have tried, running ods rtf close first and I still get the same results.  Any ideas?  Is it just not possible?

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74
75 ods rtf(web) bodytitle;
WARNING: BODYTITLE and BODYTITLE_AUX cannot be changed in mid document.

The message says that you already set the Body_title, or the default and as the message says SAS will not change the behavior in the middle of a document. You have to set the property in the first ODS RTF statement and that is the option applied to the entire document.

 

If want to mix titles in the header and the body of the document you will have to use a different approach to add text in the body such as using ODS Text or Proc Odstext instead of Title statements.

LauraRK
Quartz | Level 8
Thank you for the reply. I want bodytitle for my new document, but even if I close and reopen the SAS studio rtf web file does not allow me to set the option.
I figured out how to do it with direct save to a document, but I was hoping to just be able to change the option in SAS Studio. The challenge is that I am teaching, so I want it to be easy for my students. They are all new to SAS and also new to programming and many of them also struggle with the statistical content, not having bodytitle turned on adds to challenges when they cut and paste and means they only get one title for page. SAS studio is really nice because they can just run their code, click and download a rtf, but I was hoping there was an easy way for me to turn on bodytitle, I would be fine if it was always on. I would rather that was the default.
In SAS EG, I can just set it in options but SAS studio has more limited output options and I was hoping there was a simple way to change this that I could teach my students. This might be an issue that is unique to the OnDemand for academics version as well. I really am liking having SAS on the cloud for them but am working on some of these details.
Thank you again.
Cynthia_sas
SAS Super FREQ

Hi:

  This works for me -- using the full control method with FILE= in SAS OnDemand for Academics:

Cynthia_sas_0-1601047641366.png

 

  Here's the code to test -- you will need to make an all_output folder under your main Files (Home) top node.

ods rtf file='~/all_output/trybodytitle.rtf' bodytitle;

  title 'Twas Brillig and the Slithy Toves';
  proc print data=sashelp.class;
  run;
ods rtf close;

The ~ (tilde) is a place holder for your /home folder name. This is /home/<yourUserID> -- but you have to know what your userID is or do a right-click on Files(Home) and choose Properties to find what the path is.

 

Hope this helps,

Cynthia

 

LauraRK
Quartz | Level 8
Thank you Cythia. This confirms that I need to do "direct save". That is what I had found as well. I like your pictures and explaination very much. I do think it would be a great default option to change for the rtf. The rtf defaults in SAS I find to be very asthetically unpleasing . I do know that is personal preference, but does anyone really like that gray on the tables and nobodytitle??
🙂
LauraRK
Quartz | Level 8
sorry for the all the misspellings above.
Cynthia_sas
SAS Super FREQ

Interestingly enough. The original RTF destination inserts the title into the header of the document and the footnote into the footer of the document, by design. The developers for the original RTF felt that SAS TITLE and FOOTNOTE statement belonged up there, along with the page numbers. I guess (this is MY theory) that because the SAS page number went on the same line as title1, and since Word puts page numbers in the header, that's where the whole TITLE as HEADER etc came from originally.

BODYTITLE was NOT one of the original RTF options for creating output. It was people who needed to combine RTF documents were not thrilled with manually moving the SAS titles out of the document headers so they could put the new, combined document info up in the document header and they wanted the SAS TITLE to be inside the body of the document. That's when BODYTITLE as an option was implemented. I know... fascinating, right ... old ODS history.

For a really nice crisp "no interior lines" output the developers have come up with the JOURNAL style, which I really like. However, the gray headers and interior table lines (the RTF default style) are very popular as beginner style. However, it is SOOO easy to change those if you are using PROC PRINT, PROC REPORT or PROC TABULATE. My personal fav is to do this (since when I teach, I most always wear something purple:

ods rtf file='~/all_output/trybodytitle.rtf' bodytitle;

  title c=purple 'Twas Brillig and the Slithy Toves';
  proc print data=sashelp.class 
     style(header)={background=white color=purple font_style=bold}
     style(obsheader)={background=white color=purple font_style=bold}
     style(obs)={background=white color=purple font_style=bold};
  run;
ods rtf close;

ods rtf file='~/all_output/trybodytitle2.rtf' bodytitle style=journal;

  title c=purple 'Twas Brillig and the Slithy Toves';
  proc print data=sashelp.class 
     style(header)={background=white color=purple font_style=bold}
     style(obsheader)={background=white color=purple font_style=bold}
     style(obs)={background=white color=purple font_style=bold};
  run;
ods rtf close;



Cynthia

LauraRK
Quartz | Level 8

Thank you Cynthia.  I do think the history is interesting.  I started using SAS before there was ODS (I believe version 6.2 or something, back in 1992 on unix)  and remember being excited when I could even get RTF output and when I first used PROC MIXED with ods tables and was able to take charge of my output.  I would have disagreed with the original developers but I think it is because I am always trying to fit a lot of output in a small space and due to wanting to always save toner and resources back when we used to print things.  I too like the journal styles and really am glad they now have one with arial font.  If I was master of the world it would be bodytitle, no new page, a journal or pearl style. 

 

In case anyone googles this, 

I also like using macro variables to make pretend titles, this is especially nice for pdf, but I probably could also use it with RTF as well.

 

ods pdf file="&folder\solutions.pdf" startpage=no style=pearl;
ods escapechar='^';
*Setting up the title macro variable;
%let liketitle=^S={font=('Arial',11pt,bold) just=center};

ods text= "&liketitle Problem 2 Data Sample ^n ^n";  /*the ^n leaves some black space*/

proc print data=sashelp.cars;

run;

ods pdf close;

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1811 views
  • 1 like
  • 3 in conversation