SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Anita_n
Pyrite | Level 9

Hello all, 

I created a kaplan-meier curve using proc lifetest. I just need to output  the graph but it's given me headach. This code outputs all tables and graph but I need just the graph.

 

I also adjusted the template using: %ProvideSurvivalMacros . I guess this can also be set in there, if yes,  how? I have been searching the whole day on this issue. Please help. The gout option seems not to be the right approach.

ods pdf output='mypath\filename.pdf';
ods graphics on;
proc lifetest data=mydat plots =(s(ATRISK )) ;
time T*censor(0);
strata group;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Make sure to include the ODS PDF CLOSE statement as well. I don't see any in your code. Only when the file is closed is it 'created' for you to see.

View solution in original post

9 REPLIES 9
Reeza
Super User

GOUT pertains to SAS/GRAPH you're using ODS GRAPHICS which is an entirely different system.

 

ODS SELECT/EXCLUDE  is what you need. 

 

You can find the table/plot names in the documentation for the procedure, under Details>ODS Table Names/ODS Graphics.

You need to add something similar to :

 

ODS SELECT plotName;

 

This should work for you:

ods pdf output='mypath\filename.pdf';
ods graphics on;

ods select survivalPlot;

proc lifetest data=mydat plots =(s(ATRISK )) ;
time T*censor(0);
strata group;
run;

@Anita_n wrote:

Hello all, 

I created a kaplan-meier curve using proc lifetest. I just need to output  the graph but it's given me headach. This code outputs all tables and graph but I need just the graph.

 

I also adjusted the template using: %ProvideSurvivalMacros . I guess this can also be set in there, if yes,  how? I have been searching the whole day on this issue. Please help. The gout option seems not to be the right approach.

ods pdf output='mypath\filename.pdf';
ods graphics on;
proc lifetest data=mydat plots =(s(ATRISK )) ;
time T*censor(0);
strata group;
run;

 


 

Anita_n
Pyrite | Level 9

@Reeza Thanks for that. I tried that but I got this error message:

ERROR 22-322: Syntax error, one of the following is expected: ;, (, ACCESSIBLE,
              ACCESSIBLE_IDENTIFIER, ANCHOR, AUTHOR, BACKGROUND, BASE, BODY, BOOKMARK,
              BOOKMARKGEN, BOOKMARKLIST, BOX_SIZING, CLOSE, COLOR, COLUMNS, COMPRESS, CONTENTS,
              CSSSTYLE, DISPLAY, DOM, DPI, EXCLUDE, FILE, FONTSCALE, GFOOTNOTE, GTITLE, HOST,
              KEYWORDS, NAMED_DEST, NEWFILE, NOACCESSIBLE, NOACCESSIBLE_IDENTIFIER, NOBACKGROUND,
              NOBOOKMARKGEN, NOBOOKMARKLIST, NOCOLOR, NOCONTENTS, NOGFOOTNOTE, NOGTITLE,
              NOPDFNOTE, NOTOC, PACKAGE, PCL, PDF, PDFMARK, PDFNOTE, PDFTOC, PRINTER, PS, SAS,
              SELECT, SGE, SHOW, STARTPAGE, STYLE, SUBJECT, TEXT, TITLE, UNIFORM.
ERROR 76-322: Syntax error, statement will be ignored.
466  ods graphics on;
467  ods select survivalPlot;
468  proc lifetest data=mydata plots =(s(ATRISK )) ;
469  time T*censor(0);
470  strata GROUP;
471  run;

I think it has a problem with the ods pdf output statement because output is underlined as error. But the

ods select survivalPlot;

worked. only I had no pdf file outputted 

Reeza
Super User
That error is BEFORE the code I suggested so isn't related to the problem you're describing or the solution I suggested. Show the full code, especially the code before the ERROR.

I assumed you posted working code but realizing now your ODS PDF statement is wrong and you should have been getting errors before even though you said it was giving you output.

ODS PDF requires a FILE= not OUTPUT=.

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/n0mc4eolqoned0n16oy88mpj0e4g.htm

Anita_n
Pyrite | Level 9

@Reeza yes, I also tried using ods pdf file="mypath\mydoc.pdf", this doesn't quite display an error but doesn't also output any file

Reeza
Super User
Show your full code and log.
Anita_n
Pyrite | Level 9
ods pdf file='mypath\mydoc.pdf';
ods graphics on;
ods select survivalPlot;
proc lifetest data=mydat plots =(s(ATRISK )) ;
time T*censor(0);
strata group;
run;


NOTE: The LOGLOG transform is used to compute the confidence limits for the quartiles of the
survivor distribution. To suppress using this transform, specify CONFTYPE=LINEAR in the PROC
LIFETEST statement.
NOTE: Used was: PROZEDUR LIFETEST - (Total processing time):
real time 1.00 seconds
cpu time 0.21 seconds

 

Reeza
Super User
That is not your full log.
Reeza
Super User
Make sure to include the ODS PDF CLOSE statement as well. I don't see any in your code. Only when the file is closed is it 'created' for you to see.
Anita_n
Pyrite | Level 9

yes, you are right, it worked now. I really forgot to add ods pdf close. Thanks

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 9 replies
  • 5776 views
  • 3 likes
  • 2 in conversation