Data visualization with SAS programming

Forest Plot; Axis value not showing up

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

Forest Plot; Axis value not showing up

Hello.  I need help with creating a forest plot.  Here is a portion of the code:

layout overlay / xaxisopts=(type=log  label='               |--TRT More effective->'

linearopts=(tickvaluepriority=true

tickvaluelist=(.5 1 2 3 4 5 6 7))logopts=(viewmin=.5 viewmax=7))

yaxisopts=(reverse=true display=none) walldisplay=none;

referenceline y=ref / lineattrs=(thickness=15 color=_color);

highlowplot y=subgroups low=ORlci high=ORuci / highcap=serif lowcap=serif;

scatterplot y=subgroups x=ORest / markerattrs=(symbol=diamondfilled);

    referenceline x=.5 / lineattrs=(pattern=shortdash);

    referenceline x=1;

    referenceline x=2 / lineattrs=(pattern=shortdash);

    referenceline x=3 / lineattrs=(pattern=shortdash);

    referenceline x=4 / lineattrs=(pattern=shortdash);   

    referenceline x=5 / lineattrs=(pattern=shortdash);

    referenceline x=6 / lineattrs=(pattern=shortdash);

endlayout;

I can't seem to get the .5 to show up on the xaxis.  Any suggestions/fix?


Accepted Solutions
Solution
‎04-08-2015 04:27 PM
SAS Super FREQ
Posts: 1,145

Re: Forest Plot; Axis value not showing up

That is because there is no such option for the LOGOPTS (see doc).  Due to the unequal placement of the log tick values, some values are thinned.

A work around would be to draw your own tick values.  To do this, you can use either a BLOCKPLOT or a SCATTER with MARKERCHARACTER to draw these values.  You will have to put the values you want in a data column and use this statement in another cell at the bottom and turn off the axis for the main cell. If this is important, you will have to experiment with this a bit.

Alternately, use the SGPLOT to draw the Forest Plot, and use SGAnnotate to place the ticks and tick values.

If you attach your full code with data, I could make some suggestions.

View solution in original post


All Replies
SAS Super FREQ
Posts: 1,145

Re: Forest Plot; Axis value not showing up

It is hard to say without the resulting graph or the full program code with data.  Which release of SAS are you using?

You are using TYPE=log, but TickValueList is specified in the LinearOpts. It will not apply to Log axis.  You have to provide that in LogOpts.  Does it show all ticks if you set Type=Linear and LinearOpts=(TickVlaueFitPolicy=none)?

Contributor
Posts: 29

Re: Forest Plot; Axis value not showing up

I'm using 9.3

I tried type=linear and linearopts with tickvaluefitpolicy=none and it showed all values.

However, I would like to do this in the log scale. I'm getting an error when trying this:

layout overlay / xaxisopts=(type=log  label='more effective-->'

logopts=(tickvaluelist=(.5 1 2 3 4 5 6 7) TickVlaueFitPolicy=none))

ERROR 22-322: Syntax error, expecting one of the following: ), BASE, MINORTICKS, THRESHOLDMAX,

              THRESHOLDMIN, TICKINTERVALSTYLE, VIEWMAX, VIEWMIN.

ERROR 76-322: Syntax error, statement will be ignored.

Solution
‎04-08-2015 04:27 PM
SAS Super FREQ
Posts: 1,145

Re: Forest Plot; Axis value not showing up

That is because there is no such option for the LOGOPTS (see doc).  Due to the unequal placement of the log tick values, some values are thinned.

A work around would be to draw your own tick values.  To do this, you can use either a BLOCKPLOT or a SCATTER with MARKERCHARACTER to draw these values.  You will have to put the values you want in a data column and use this statement in another cell at the bottom and turn off the axis for the main cell. If this is important, you will have to experiment with this a bit.

Alternately, use the SGPLOT to draw the Forest Plot, and use SGAnnotate to place the ticks and tick values.

If you attach your full code with data, I could make some suggestions.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 472 views
  • 0 likes
  • 2 in conversation