BookmarkSubscribeRSS Feed
SASuserlot
Barite | Level 11

I have two questions

1.When I am running the proc life test. It generating the png/jpeg picture files of the graph  in the location where the program saved. How can I avoid this.

2. Is  there a simple way I can just output the proc life test graph into rtf file  using ODS. I tried running the proc life in ODS but this printing the data  from the datasets generated.

Really appreciate your help. Thanks

2 REPLIES 2
Cynthia_sas
Diamond | Level 26

Hi:

  Take a look at this example: https://support.sas.com/documentation/onlinedoc/stat/ex_code/143/liftex4.html -- I modified it slightly to just use the first LIFETEST step -- same data as in the example. Using the "full control" ODS statements, I get this output (showing first 2 pages of 3 total pages):

Cynthia_sas_0-1621023081945.png

 

from this code (using the dataset from the documentation link):


options nodate number;
ods rtf file='c:\temp\lifetest.rtf';
ods graphics on/imagefmt=jpg imagename='lftst';
proc lifetest data=Bmt plots=cif(test) timelist=0.5 1.0 1.5 2.0 4.0 6.0;
   time Dftime*Status(0)/eventcode=1;
   strata Disease / order=internal;
   format Disease diseaseLabel. Gender genderLabel.;
run;

ods rtf close;

  I included the ODS GRAPHICS statements to change the image format and image name, however, ODS RTF actually embeds the image into the RTF file.If you open the RTF file with NOTEPAD instead of Word, you can find the place where the image is embedded, as shown below:

Cynthia_sas_1-1621023473140.png

 

If you want to get some of the ODS OUTPUT into the RTF file and some of the ODS OUTPUT (like the graph) just into a JPEG file, then you'll still need to use ODS SELECT. Let's use a hypothetical example. What if you wanted only the Failures Summary and the Gray's Test output in the RTF file and you wanted to write the CIF plot to a folder as a JPEG image file? That's where you would need to use ODS TRACE to find the names of these output and graph objects so you could build the correct ODS SELECT statements:

Cynthia_sas_2-1621024651180.png

  You'll need to run the code at least one time to get the name of the objects before you have your final output. And then these are the files created -- shown in C:\temp location:

Cynthia_sas_3-1621024763442.png

 

  If you ONLY want the plot in the RTF file, then you would do something like this and select only the plot to go into the RTF file. Note that I removed the ODS TRACE from this code because I already knew the name of the cifPlot object:

Cynthia_sas_4-1621025243487.png

 

 

  Hope this helps you figure out how to get your output into the desired destination.

 

Cynthia

SASuserlot
Barite | Level 11

Thank you so much Cynthia. You covered me alot. I will try all of them . and I will reach again if I stuck any where. Thanks Again.

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
  • 2 replies
  • 2139 views
  • 2 likes
  • 2 in conversation