The SAS Output Delivery System and reporting techniques

Proc sgpanel: specifying colaxis tick values messes up curve [includes images]

Reply
Learner
Posts: 1

Proc sgpanel: specifying colaxis tick values messes up curve [includes images]

[ Edited ]

I'm working in SAS 9.4 on panel graphs which look as follows:

curve.png

Using code:

 

proc sgpanel data=mydata; 
   format period perf. group grpf. time best8.;
   styleattrs datacontrastcolors=(darkblue bigb liyg vpap gold); 
   panelby group / spacing=5 novarname columns=2;
   vline time / response=myoutcome group=period lineattrs=(thickness=2 pattern=solid);
   colaxis display=(novalues) values=(0 to 24) max=24 label='Time'; 
   rowaxis values=(0 to 100 by 20) grid label='% with outcome';
   keylegend / title='Grouping var';
run; 

 

 Whenever I try to specify which values should be shown on the x-axis, using *any* of these options: 

 

colaxis values=(0 to 24 by 3); 

colaxis values=(0 3 6 9 12 15 18 21 24);

colaxis refticks=(values) values=(0 3 6 9 12 15 18 21 24);

  

the graph gets messed up - it's no longer the curve it should show, esp. for low values, and it seems to shorten one of the curves (yellow):

pointy.png

 

In general, there seems to be something off with the x-axis, when I specify for example colaxis values=(0 3 6 24), the spacing is even between all these values, although it obviously shouldn't be. I thought it may be because of inconsistent time intervals in my input dataset (0.1, 0.2, 0.3... until 1.0, and then 2.0, 3.0..., with format 8.3 in dataset), but when I edited the set to include only values spaced by 1 (0.0, 1.0, 2.0...), I had the same problem. 

 

How can I specify what I want shown on the x-axis (0 to 24 by 3) & keep the actual curve as it should be? Thank you!

Super User
Posts: 12,996

Re: Proc sgpanel: specifying colaxis tick values messes up curve [includes images]

Your comment about time makes me think that you might benefit by changing that variable into an actual SAS time, or possibly datetime if your values cross midnight or exceed 24 hours. Values lists understands some time interval elements such as 'second', 'hour' or 'minute' if the values are actually times. OR you could could specify a BY element that is number of seconds and format the displayed values.

 

It might help to show some data that will duplicate the problem for one of the group/ period combinations.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

Ask a Question
Discussion stats
  • 1 reply
  • 81 views
  • 0 likes
  • 2 in conversation