BookmarkSubscribeRSS Feed
ChristosK
Quartz | Level 8

Ive put this  figure together with this code but in the results windows, the keylegend has values, as it should , but it always appears in a column. Ive tried running different across and down statements.

Also, it does not appear in the pdf file I save it to, but does appear in an RTF or word file. Why?

 

I just went to change the discretelegend or keylegend so it is on one line. For some reason keylegend does not work in this code .

 

 

 

 

 

ods listing close;
ods html style=mystyle path='.' file='newgraph.html';
ods graphics / reset=all border=off width=600 height=800  maxlegendarea=45 ;
   
   proc sgplot data=glm_MAP2 nowall noborder  ;

      title 'Linear Regression Models with Parameter estimates and SD for MAP';
      styleattrs datacontrastcolors=(CX016381 CX1BC9FF CXFF7F00 CX814101  ) ;

refline "mean Nex" "mean LA" "mean UA" "mean LL"/ discretethickness=1 lineattrs=(color=pink) axis=y;
hbarparm category=IV  response= Param / group =DV groupdisplay =cluster  grouporder=data 
barwidth=0.4  clusterwidth=1   limitupper=SD_Param    ;

yaxis type=discrete discreteorder=data label =".";
xaxis label ="."; 
discretelegend  / across=1 location=outside   noborder;  
yaxistable N rpIII  rParam rLCL 	rUCL/ VALUEATTRS=(Color=Black Family=Arial Size=7  Weight=Normal ) VALUEHALIGN=CENTER VALUEJUSTIFY= CENTER ;
 run;

4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi, well, the documentation on ACROSS explains that ACROSS tells the procedure the number of legend entries that are to be placed horizontally on one row before the next row begins. So it seems ACROSS=1 is what you're getting.

DOWN= legend provides the number of entries that are placed vertically before the next column begins. Have you tried either ACROSS=7 or DOWN=1???

Cynthia
ChristosK
Quartz | Level 8
Thanks Cynthia.
Neither worked. I looked through the guidelines you mentioned and tried a bunch of different variations but none worked.
ChristosK
Quartz | Level 8

This is the error I get when I use "Down=1":

 NOTE: PROCEDURE SGPLOT used (Total process time):
       real time           0.38 seconds
       cpu time            0.20 seconds
       
 WARNING: DISCRETELEGEND statement with DISPLAYCLIPPED=FALSE is getting clipped. The legend will not be drawn.
 WARNING: DISCRETELEGEND statement with DISPLAYCLIPPED=FALSE is getting clipped. The legend will not be drawn.
 WARNING: The font <sans-serif> is not available. Albany AMT will be used.
 WARNING: DISCRETELEGEND statement with DISPLAYCLIPPED=FALSE is getting clipped. The legend will not be drawn.
 WARNING: The font <sans-serif> is not available. Albany AMT will be used.
 NOTE: There were 28 observations read from the data set USER.GLM_MAP2.
 
 92         
 93         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

Same thing with "Across=7":

 NOTE: PROCEDURE SGPLOT used (Total process time):
       real time           0.42 seconds
       cpu time            0.20 seconds
       
 WARNING: DISCRETELEGEND statement with DISPLAYCLIPPED=FALSE is getting clipped. The legend will not be drawn.
 WARNING: DISCRETELEGEND statement with DISPLAYCLIPPED=FALSE is getting clipped. The legend will not be drawn.
 WARNING: The font <sans-serif> is not available. Albany AMT will be used.
 WARNING: DISCRETELEGEND statement with DISPLAYCLIPPED=FALSE is getting clipped. The legend will not be drawn.
 WARNING: The font <sans-serif> is not available. Albany AMT will be used.
 NOTE: There were 28 observations read from the data set USER.GLM_MAP2.
 
 92         
 93         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
Cynthia_sas
SAS Super FREQ
Hi:
It may be that there's not enough room I noticed you've also got an YAXISTABLE, which might be cutting down on the available area for the legend. I believe that is a message that gets sent out when you specify a legend and it won't fit. You might want to move this to the ODS GRAPHICS forum where the heavy duty ODS GRAPHICS folks hang out.

Cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3884 views
  • 5 likes
  • 2 in conversation