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

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 ;
 

1 ACCEPTED SOLUTION

Accepted Solutions
sueshaw
Obsidian | Level 7

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.

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
sueshaw
Obsidian | Level 7

I have attached my program  and 2 outputs..

help will be greatly appreciated.

 

DanH_sas
SAS Super FREQ

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

DanH_sas
SAS Super FREQ

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

sueshaw
Obsidian | Level 7

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.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2283 views
  • 2 likes
  • 3 in conversation