BookmarkSubscribeRSS Feed
lansoprazole
Obsidian | Level 7

Hi, 

 

I am trying to expand the Y-axis (probability) of CIF plot that is created by PROC PHREG. 

 

I found that TIMERANGE and RANGE only change the X-axis range (I was able to customize the X-axis range).

 

Is there any option to change the Y-axis to be between 0 - 1?

 

This is my first line code;

proc phreg data = XYZ plots (range = (0,15))= cif;

 

Thanks,

W

1 REPLY 1
Zard
SAS Employee

If you still need it... you can modify the plot template to customize the y-axis range in a CIF plot. 

 

Here is a default plot:

 

ods select CIFPlot;
proc phreg data=Bmt plots(overlay)=cif;
  class Disease;
  model T*Status(0)=Disease / eventcode(cox)=1;
  baseline covariates=Risk;
run;

 

Zard_0-1682609968951.png

 

You can add the following LinearOpts= in the YaxisOpts option to specify your own y-axis range:

 

proc template;
  define statgraph Stat.PHReg.Graphics.Cif;
    dynamic title1 title2 title3 title4 xviewMin xviewMax group groupIndex
      groupName plotCL transparency _byline_ _bytitle_ _byfootnote_;
    BeginGraph;
      entrytitle TITLE1 TITLE3;
      entrytitle TITLE2 TITLE4 / textattrs=GRAPHVALUETEXT;
      layout overlay / xaxisopts=(linearopts=(viewmin=XVIEWMIN viewmax=
       XVIEWMAX)) yaxisopts=(label="Probability"
       linearopts=(viewmin=0 viewmax=1 tickvaluelist=(0 .2 .4 .6 .8 1.0)));
       if (PLOTCL)
        bandplot LimitLower=LOWERCIF LimitUpper=UPPERCIF x=TIME / group
          =GROUP index=GROUPINDEX modelname="CIF" datatransparency=
          transparency;
       endif;
      stepplot y=CIF x=TIME / group=GROUP index=GROUPINDEX name="CIF";
      if (EXISTS(GROUP))
        discretelegend "CIF" / location=outside title=GROUPNAME;
      endif;
    endlayout;
    if (_BYTITLE_)
      entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
    else
      if (_BYFOOTNOTE_)
        entryfootnote halign=left _BYLINE_;
     endif;
    endif;
    EndGraph;
  end;
run;
ods select CIFPlot;
proc phreg data=Bmt plots(overlay range=0,500)=cif;
  class Disease;
  model T*Status(0)=Disease / eventcode(cox)=1;
  baseline covariates=Risk;
run;

Zard_1-1682610096482.png

 

Delete the modified template to revert back to the default plot:

 

proc template;
  delete Stat.PHReg.Graphics.Cif;
run;

 

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 1 reply
  • 1436 views
  • 0 likes
  • 2 in conversation