Hello all,
I am working on a customized version a failure plot using GTL. It's my first stab at it, and I've been able to glean a decent amount of information from Sanjay's work and the Producing High-Quality Figures Using SAS/GRAPH® and ODS Graphics Procedures book to get to the point where I'm almost satisfied with what I need. My last remaining problem is being able to customize the x and y axis to be bolder or have a greater thickness. I believe I need to use the GraphGridLines option but I'm not sure where it would go in the code I've included below. (Note: a dummy dataset is included for anyone super curious)
The examples I've seen more or less focus on modifying pre-existing table styles and using this option. Since this table is 'built from scratch' I'm not sure where to invoke this option. Is this the correct option for a bolder axis? If so, how can I use it? Does it go in a style statement? Or is there a better option?
Thanks!
Erica
%let outloc = ..\figures; proc format; value drugdf 1 = 'Drug A' 2 = 'Drug B'; run; data BCANCER; input Subjid Drug Year Status @@; format Drug drugdf.; label Year = "Survival Time (Yr)" status = "Status: 1 = death, 0 = cencored"; datalines; 1 1 10 0 2 1 9 1 3 1 5 1 4 1 9 1 5 1 10 1 6 1 3 1 7 1 10 0 8 1 7 1 9 1 10 0 10 1 10 0 11 1 10 0 12 1 3 0 13 1 6 1 14 1 10 0 15 1 10 0 16 1 1 1 17 1 10 0 18 1 10 0 19 1 10 0 20 1 5 0 21 1 10 0 22 1 10 0 23 1 10 0 24 1 10 0 25 1 4 1 26 1 10 0 27 1 10 1 28 1 10 0 29 1 10 0 30 1 10 0 31 1 2 1 32 1 10 0 33 1 10 0 34 1 10 0 35 1 8 1 36 1 10 0 37 1 10 0 38 1 9 0 39 1 10 0 40 1 10 0 41 1 10 0 42 1 2 1 43 1 10 0 44 1 10 1 45 1 10 0 46 1 10 0 47 1 5 1 48 1 10 0 49 1 10 0 50 1 9 1 51 2 4 1 52 2 10 1 53 2 2 1 54 2 5 1 55 2 10 0 56 2 1 1 57 2 10 0 58 2 9 1 59 2 3 1 60 2 10 0 61 2 3 0 62 2 6 1 63 2 10 0 64 2 3 1 65 2 10 0 66 2 4 1 67 2 10 0 68 2 2 1 69 2 10 0 70 2 5 1 71 2 10 1 72 2 8 0 73 2 10 0 74 2 2 1 75 2 10 0 76 2 6 1 77 2 10 0 78 2 3 0 79 2 10 1 80 2 8 1 81 2 10 0 82 2 3 1 83 2 10 0 84 2 7 1 85 2 10 1 86 2 10 0 87 2 3 1 88 2 10 0 89 2 10 0 90 2 2 1 91 2 10 0 92 2 4 1 93 2 10 0 94 2 10 1 95 2 8 1 96 2 10 0 97 2 1 1 98 2 10 0 99 2 10 0 100 2 3 1 ; run; ods graphics on; ods listing gpath = "&outloc."; ods output Failureplot = failureplot;ods select failureplot(persist); ods graphics/reset = all width = 8in height = 6in noborder OUTPUTFMT = EMF imagename = "Failure Plot 1"; proc lifetest data = BCANCER plots = survival(failure test atrisk = 0 to 10 by 1); time Year * Status(0); strata Drug; run; proc sort data = failureplot out = failureplot2 nodup; by Time Survival AtRisk Event Censored tAtRisk Stratum StratumNum _1_SURVIVAL_ _1_CENSORED_; run; ods select all; proc template; define statgraph SurvivalPlotAtRisk_Outside_Scatter; begingraph; entrytitle 'Product-Limit Survival Estimates'; entrytitle 'With Number of AML Subjects at Risk' / textattrs=(size=10); layout lattice / columns=1 rowweights=(0.90 0.10) rowgutter=10; layout overlay / yaxisopts=(linearopts=(viewmin=0)); stepplot x=time y=survival / group=stratum curvelabel=stratum lineattrs=(pattern=solid thickness =2) name='s'; endlayout; layout overlay / xaxisopts=(display=none) walldisplay=none yaxisopts=(display=(tickvalues) tickvalueattrs=(size=10)) ; scatterplot x=tatrisk y=stratum / group=stratum markercharacter=atrisk markercharacterattrs=(size=10); endlayout; endlayout; endgraph; end; run; /*--Survival Plot with outer Risk Table using Scatter Plot--*/ ods graphics/reset = all width = 8in height = 6in noborder OUTPUTFMT = EMF imagename = "FP_AR"; proc sgrender data=failureplot2 template=SurvivalPlotAtRisk_Outside_Scatter; format stratumNum drugdf.; run;
This code should work for EMF output as well. If you want to generate EMF output, you will want to do something like the following:
ods listing style=mystyle;
ods graphics / imagefmt=emf;
/* your SGRENDER call */
Let me know if you have any issue with it.
Thanks!
Dan
You will need a little PROC TEMPLATE code to create a small style that changes the axis line thinkness:
proc template;
define style styles.mystyle; /* Or what ever name you want */
parent=styles.HTMLBlue;
style GraphAxisLines from GraphAxisLines /
linethickness = 3px /* or your desired thickness */
;
end;
run;
You might also need to add GraphBorderLines to the style to get the desired look. After you run the style code, you will need to set your style on the ODS destination:
ods html file="whatever.html" style=mystyle;
Hope this helps!
Dan
Thanks for the input, Dan. I think that's a good solution for a PDF or RTF output which may be of use for me. I guess I didn't mention it in my original post, but I've been asked to focus on having this output to be accessible also in EMF format. Is there anything else I can do if I want it to work for an EMF file type?
This code should work for EMF output as well. If you want to generate EMF output, you will want to do something like the following:
ods listing style=mystyle;
ods graphics / imagefmt=emf;
/* your SGRENDER call */
Let me know if you have any issue with it.
Thanks!
Dan
Thanks for the help Dan! It worked out great.
Chartis names SAS a leader in both Model Risk Governance and Model Validation