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

Hi all,

 

I am trying to split the xasix values in two lines with PROC SGPLOT but it is not working.

 

Thanks for your idea.

 

proc sgplot data=trt;
  scatter x=vis y=mean/group=trt01an yerrorlower=lower yerrorupper=upper markerattrs=(symbol=circlefilled) ;
  series x=vis y=mean/group=trt markers markerattrs=(symbol=circlefilled) name='a';
  keylegend 'a'/location=outside position=BOTTOM;
  xaxis values=(1 2 3 4 5 6 7 8) VALUESDISPLAY=("Day 2" "Day 4" "Day 6" "Day 8" "Day 10" "24 hour post*the last dose" 
  "Exit*(Day 14)" "Follow up*(Day 17)")  FITPOLICY=SPLIT SPLITCHAR="*"  label='Planned Time Point' offsetmin=0.05 offsetmax=0.05;
  yaxis label='Mean of Change from Baseline with 95% CI';
run;

split.png

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

I believe the reason that you're getting the behavior you're getting is that a FITPOLICY of SPLIT does not work on a LINEAR axis. Try doing the following:

 

1. Since you're placing your data in equidistant locations, set TYPE=DISCRETE on the XAXIS.

2. It appears that you always want to split on the "*", so use FITPOLICY=SPLITALWAYS instead of SPLIT. The SPLIT policy will happen only if there is a tick value collision while fitting.

3. On the SCATTER and SERIES, set GROUPDISPLAY=CLUSTER. This will cluster each of your groups around each X value. Make sure your "vis" values are only 1-8, as it appears like the X values might be adjusted slightly to get the look in your picture.

 

Hope this helps!
Dan

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Hi and welcome to the SAS Communities 🙂

 

What are you trying to achieve? Can you explain a bit further what your desired result looks like?

DanH_sas
SAS Super FREQ

I believe the reason that you're getting the behavior you're getting is that a FITPOLICY of SPLIT does not work on a LINEAR axis. Try doing the following:

 

1. Since you're placing your data in equidistant locations, set TYPE=DISCRETE on the XAXIS.

2. It appears that you always want to split on the "*", so use FITPOLICY=SPLITALWAYS instead of SPLIT. The SPLIT policy will happen only if there is a tick value collision while fitting.

3. On the SCATTER and SERIES, set GROUPDISPLAY=CLUSTER. This will cluster each of your groups around each X value. Make sure your "vis" values are only 1-8, as it appears like the X values might be adjusted slightly to get the look in your picture.

 

Hope this helps!
Dan

Lee_wan
Obsidian | Level 7

Amazing! It's working! 

Thank you very muck!

 

You're a Picasso in the SAS figure.

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
  • 3 replies
  • 2759 views
  • 1 like
  • 3 in conversation