Hi everyone,
I am trying to add an annotation to an SGPANEL plot. You can see my code as follows:
DATA marg_anno;
length function widthunit justify anchor $10 label $100;retain drawspace function width widthunit textstyle justify anchor textsize;
drawspace="datavalue";
function="text";
width=10;
widthunit="data";
textstyle="normal";
justify="left";
anchor="left";
textsize=9;label = "P=&pval_marginal66";
x1=1;
y1=40;
output;
run;PROC SGPANEL data=marginal66 noautolegend sganno=marg_anno;
panelby median_dose;
series y=pred x=visno / group=median_dose;
scatter y=pred x=visno / errorbarattrs=(color=black) markerattrs=(size=0) yerrorlower=lower yerrorupper=upper;
colaxis values=(1 to 2 by 1);
label visno = "Visit" pred="Predicted GMFM-66";
format visno t.;
run;
The call to SGPANEL gives me the error: "WARNING: XSPACE= is invalid. Draw statement discarded"
I cannot see any reason why this would be the case. And, in fact, it gives me this error message regardless of what value I enter in, and regardless of the drawspace I enter. It tells me that it is invalid in every single case I have tried.
Does anybody have an idea what is going on? I tried searching this error, but have found nothing referencing it in the documentation or forums.
Well, I found the answer. My fault for not reading the documentation quite carefully enough. A little footnote at the bottom indicates that the only options that work with SGPANEL are GRAPHPERCENT, GRAPHPIXEL, LAYOUTPERCENT, and LAYOUTPIXEL, when I was trying to use WALLPERCENT and WALLPIXEL.
The "datavalue" drawspace cannot be used with SGPANEL because there are multiple "datavalue" spaces (i.e. panel cells), and there is currently not a way to address a particular cell. With SGPANEL, you must use percentage or pixel-based units for now.
I guess I should have been more specific in my OP, but when I said, " regardless of the drawspace I enter" that included both percentage and pixel-based units. It still gave me the same error. It doesn't matter which drawspace I use or how I try to define the positioning in SGPANEL, it always says that the XSPACE is invalid.
Well, I found the answer. My fault for not reading the documentation quite carefully enough. A little footnote at the bottom indicates that the only options that work with SGPANEL are GRAPHPERCENT, GRAPHPIXEL, LAYOUTPERCENT, and LAYOUTPIXEL, when I was trying to use WALLPERCENT and WALLPIXEL.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.