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

plot of the odds ratios and their 95% confidence intervals created using SAS PROC SGPLOT, 

 

but some of the tick values have been thinned. How plot the figure without remove or thinned tick values ? 

 

Thanks a lot! 

 

 

 title "SGPLOT: Forest Plot";
   proc sgplot data=excel_b;
    scatter x=oddsratioest y=effect / xerrorlower=lowercl
                                  xerrorupper=uppercl
                                  markerattrs=or
                                 (symbol=DiamondFilled size=5);
    refline 1 / axis=x;
    xaxis label="OR and 95% CI " min=0.9;
    yaxis label="Covariates";
  run;

 

                                                      

vBQcbWl.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

With that many discrete vertical labels, there isn't enough room to plot them all without labels overlapping (which SGPLOT tries to avoid). You can

1. Decrease the font size for the tick values. Probably size=8 is about the smallest that can be read.

2. Increase the vertical size of the plot. Plots can stretch arbitrarily long.

3. Do both

 

To decrease the font size, use 

YAXIS / valueattrs=(size=8);

 

To increase the vertical dimension of the graph, use the following BEFORE the call to PROC SGPLOT, For example:

ods graphics / width=500px height=800px;

 

Another option: Since you have two stages, you could use PROC SGPANEL to create a panel of plots, one for each stage.

 

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

With that many discrete vertical labels, there isn't enough room to plot them all without labels overlapping (which SGPLOT tries to avoid). You can

1. Decrease the font size for the tick values. Probably size=8 is about the smallest that can be read.

2. Increase the vertical size of the plot. Plots can stretch arbitrarily long.

3. Do both

 

To decrease the font size, use 

YAXIS / valueattrs=(size=8);

 

To increase the vertical dimension of the graph, use the following BEFORE the call to PROC SGPLOT, For example:

ods graphics / width=500px height=800px;

 

Another option: Since you have two stages, you could use PROC SGPANEL to create a panel of plots, one for each stage.

 

Jay54
Meteorite | Level 14

Also, you can use FITPOLICY=none for the yaxis.

DougZ
Obsidian | Level 7

I have a similar problem with SGPLOT - it seems to ignore all my suggestions.  I want an x axis with a format of monname1., i.e., JFMAMJJASOND, but with the code below (and variations) I always get this in the log, and an axis that shows "01Jan 01Feb 01Mar..."

 

ods graphics / width=1000px height=600px;

proc sgpanel data=work.mean_xyz;
where upcase(some_category) = "BLAHBLAH";
panelby product;
colaxis valuesformat=monname1. valueattrs=(size=8) fitpolicy=none;
rowaxis label="XYZ";
series x=obsdate y=model_xyz;
series x=obsdate y=act_xyz;
run;

 

NOTE: The column format YYMMDDD10 is replaced by an auto-generated format on the axis.
NOTE: Some of the tick values have been thinned.

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
  • 4 replies
  • 7293 views
  • 2 likes
  • 4 in conversation