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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

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

3 REPLIES 3
Jay54
Meteorite | Level 14

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)?

dtchoi86
Fluorite | Level 6

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.

Jay54
Meteorite | Level 14

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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