BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AncaTilea
Pyrite | Level 9

Hi.

I have hazard ratios (HR) from a survival model. I want to plot the log of HR with the associated confidence interval, BUT display the LINEAR values.

I got the data labels to show the linear values, but I can't figure out how to modify the y-axis to plot the log values, but show the linear values.

Below is what I have, as an example,

data have;

    input Group  HR Low High;

l_hr=log10(hr);

l_low=log10(low);

l_high=log10(high);

datalines;

1  .      .         .

2  0.80  0.78     0.82

3  0.70  0.68     0.72

4   0.60  0.58     0.62

;

run;

proc template;

define statgraph Graph;

dynamic _GROUP _L_HR _L_HIGH _L_LOW _HR;

begingraph / designwidth=1327 designheight=775;

   layout lattice / rowdatarange=data columndatarange=data rowgutter=10 columngutter=10;

      layout overlay / walldisplay=none xaxisopts=( display=(TICKS TICKVALUES  LINE )

                       tickvalueattrs=(size=12 style=NORMAL weight=BOLD ))

                       yaxisopts=( display=(TICKS TICKVALUES LINE )

                       tickvalueattrs=(size=12 style=NORMAL weight=BOLD)

                       linearopts=( /*tickvaluesequence=( start=-0.25 end=0.0 INCREMENT = 0.05)*/

                       tickvaluelist=(-0.25 -0.15 -0.05 0.00 )) logopts=( base=10));

         scatterplot x=_GROUP y=_L_HR / datalabel=_HR yerrorupper=_L_HIGH yerrorlower=_L_LOW name='scatter'

                     datalabelposition=RIGHT datalabelattrs = (size = 12 WEIGHT = BOLD) markerattrs=(symbol=CIRCLEFILLED size=9 ) errorbarattrs=(thickness=2 );

         referenceline y=0.0 / name='href' curvelabel = "Reference"

                                curvelabelposition = min curvelabelattrs = (size = 12) yaxis=Y;

     endlayout;

   endlayout;

endgraph;

end;

run;

proc sgrender data=WORK.have template=Graph;

dynamic _GROUP="GROUP" _L_HR="'L_HR'n" _L_HIGH="'L_HIGH'n" _L_LOW="'L_LOW'n" _HR="HR";

run;

Any suggestions are appreciated!

Thank you!

Anca.

PS: how can I paste SAS code in this compose box and make it look like SAS code (color coded)?


want.png
1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

You are transforming the data itself into the log scale.  What if you keep the data as is, and set the Y axis to log?

View solution in original post

2 REPLIES 2
Jay54
Meteorite | Level 14

You are transforming the data itself into the log scale.  What if you keep the data as is, and set the Y axis to log?

AncaTilea
Pyrite | Level 9

Thank you Sanjay,

I was transferring from old way of GPLOT + ANNO where I needed to use the logs...

Thanks.

Got it!

Anca.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2587 views
  • 0 likes
  • 2 in conversation