Data visualization with SAS programming

PROC SGPANEL

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

PROC SGPANEL

[ Edited ]

Ho do i get rid of white space within each cell that results from altering the variable used as datalabel (see attached pdf image).

 

E.g. in cell "-Overall-" I want to show the discrepancy in timeliness of first antibiotics administrations and subsequent administrations. The green line presents first administration and the dark green line subsequent administrations. The vertical bar chart is the distribtion for the first administration. 

 

When I use labels that only contain "60.0%" and "44.1%", I don't have a problem with white space. But I want to help the reader and added " | 1st admin." and " |nth admin." using:

 

sum30cL=strip(strip(sum30c)!!" | 1st admin.");
sum30cOverallL=strip(strip(sum30cOverall)!!" | nth admin.");

 

sum30cL and sum30cOverallL have normal length, format and informat.

 

Anyone knows the reason of the sudden white space on the right side within each cell?

 

 

Code for plot:


ods listing;
ods graphics /
reset=index
imagename='Figure overall colour'
imagefmt=jpg
width=40cm
height=30cm
noborder;
ods listing gpath="&bron " image_dpi=400;
proc sgpanel data=fig1tot noautolegend;
panelby ABclass /
columns=2
rows=5
spacing=5
novarname
noborder
noheaderborder
skipemptycells
headerbackcolor="#2c7fb8"
headerattrs=(color=white size=8 weight=bold family=calibri)
sort=ascformat;
vline diffvstoedcat /response=sum30 lineattrs=(color="#b3de69" pattern=solid thickness=2)
datalabel=sum30cL datalabelpos=right datalabelattrs=(size=8 color=darkgrey family=calibri weight=bold);
vline diffvstoedcat /response=sum30Overall lineattrs=(color="darkgreen" pattern=solid thickness=2)
datalabel=sum30cOverallL datalabelpos=right datalabelattrs=(size=8 color=darkgrey family=calibri weight=bold);
vbar diffvstoedcat / response=_PERC_
baselineattrs=(thickness=0)
nozerobars
colorresponse=diffvstoedcat2 colormodel=("#b3de69" "#fb8072" "black")
nooutline fill
datalabel=_PERC_2 datalabelattrs=(size=6 color=darkgrey family=calibri) datalabelfitpolicy=rotate;
dropline x=0 y=30/ lineattrs=(pattern=36 thickness=1 color="#377eb8") dropto=x;
rowaxis display=(noline noticks) label="Percentage"
valueattrs=
(family=calibri
color=black
size=8
style=normal)
values=(0,10,20,30,40,50,60,70,75)
valuesdisplay=("0%" "10%" "20%" "30%" "40%" "50%" "60%" "70%" "")
labelattrs=
(family=calibri
color=black
size=8
style=normal
weight=bold);
colaxis display=(noticks) label="Minutes deviation from prescribed"
valueattrs=
(family=calibri
color=black
size=8
style=normal)
values=(-13 to 14 by 1)
valuesdisplay=(">-120min" "-110min to -119min" "-100min to -109min" "-90min to -99min" "-80min to -89min"
"-70min to -79min" "-60min to -69min" "-50min to -59min" "-40min to -49min" "-30 to -39min" "-20min to -29min"
"-10min to -19min" "0min to -9min" "0" "0min to 9min" "10min to 19min"
"20min to 29min" "30min to 39min" "40min to 49min"
"50min to 59min" "60min to 69min" "70min to 79min"
"80min to 89min" "90min to 99min" "100min to 109min"
"110min to 119min" ">120min" "Not administered")
labelattrs=
(family=calibri
color=black
size=8
style=normal
weight=bold);
colaxistable _FREQ_/
label
position=bottom
droponmissing
valueattrs= (family=calibri
size=5
style=normal)
labelattrs=
(family=calibri
color=black
size=8
style=normal);
label _FREQ_="n=";
run;
ods graphics off;
ods listing close;


Accepted Solutions
Highlighted
Solution
‎02-28-2018 02:10 PM
SAS Super FREQ
Posts: 1,102

Re: PROC SGPANEL

The space is there to account for the possibility of the VLINE going to the end of the axis, with your label on the end of that line. However, since you know that will not happen in your case, use the OFFSETMAX option on the COLAXIS statement to manually adjust the axis offset to remove the space.

 

Hope this helps!

Dan

View solution in original post


All Replies
Highlighted
Solution
‎02-28-2018 02:10 PM
SAS Super FREQ
Posts: 1,102

Re: PROC SGPANEL

The space is there to account for the possibility of the VLINE going to the end of the axis, with your label on the end of that line. However, since you know that will not happen in your case, use the OFFSETMAX option on the COLAXIS statement to manually adjust the axis offset to remove the space.

 

Hope this helps!

Dan

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 166 views
  • 1 like
  • 2 in conversation