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;
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;
@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 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
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
yes, you are right, it worked now. I really forgot to add ods pdf close. Thanks
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.