BookmarkSubscribeRSS Feed
frewq
Calcite | Level 5

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!

1 REPLY 1
ballardw
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1 reply
  • 1985 views
  • 0 likes
  • 2 in conversation