I am new to SGPLOT, thank for help.
I want to output a band with (ll uu)xval. but the following statements produced different result...
1) band x=val lower=ll upper=uu / fill outline transparency=0.3;
2) series x=val y=ll /lineattrs=(pattern=dash color=black) ;
series x=val y=uu /lineattrs=(pattern=dash color=black);
I also want to add symbol at val*estimate, and draw a line with lower and upper bar on some of x values
series x=val2 y=estimate2 /group=dose grouporder=data lineattrs=(pattern=solid) markers datalabel=xlab;
scatter x=val2 y=estimate2/group=dose grouporder=data yerrorupper=uu2 yerrorlower=ll2 ;
Thanks for your help.
I need to have x2axis display=none; because I dont want to show value on x axis.
instead, I only want want to show some values (val2).
I used your recommendation, and problem solved.
I added
1) series x=val y=ll/transparency=1
2) series x=val y=uu/transparency=1;
please find my final output attached.
note: I used sganno to add label to x axis, that's other problems that I need to work on....
thank you.
@sueshaw wrote:
I am new to SGPLOT, thank for help.
I want to output a band with (ll uu)xval. but the following statements produced different result...
1) band x=val lower=ll upper=uu / fill outline transparency=0.3;
2) series x=val y=ll /lineattrs=(pattern=dash color=black) ;
series x=val y=uu /lineattrs=(pattern=dash color=black);
What different result? Show us.
I also want to add symbol at val*estimate, and draw a line with lower and upper bar on some of x values
series x=val2 y=estimate2 /group=dose grouporder=data lineattrs=(pattern=solid) markers datalabel=xlab;
scatter x=val2 y=estimate2/group=dose grouporder=data yerrorupper=uu2 yerrorlower=ll2 ;
What happened when you tried? Show us.
I have attached my program and 2 outputs..
help will be greatly appreciated.
There does seem to be an issue to be investigated. However, I can give you a workaround:
proc sgplot data=resp_1 noautolegend;
series x=val y=ll / transparency=1;
band x=val lower=ll upper=uu / fill outline transparency=0.3 x2axis;
series x=val2 y=estimate2 /group=dose grouporder=data lineattrs=(pattern=solid) markers datalabel=xlab;
scatter x=val2 y=estimate2/group=dose grouporder=data yerrorupper=uu2 yerrorlower=ll2 ;
x2axis display=none;
xaxis label="xlab" display=none;
yaxis label="ylab" ;
run;
Hope this helps!
Dan
A colleague here at work spotted the issue -- The X2AXIS option on the BAND plot (sorry I missed that). Having the BAND on a different xaxis from the scatter plot causes your misalignment because the two axes will have different ranges (your band has a longer range than you scatter plot). Just remove that option, and you should be fine.
Thanks!
Dan
Thanks for your help.
I need to have x2axis display=none; because I dont want to show value on x axis.
instead, I only want want to show some values (val2).
I used your recommendation, and problem solved.
I added
1) series x=val y=ll/transparency=1
2) series x=val y=uu/transparency=1;
please find my final output attached.
note: I used sganno to add label to x axis, that's other problems that I need to work on....
thank you.
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.