BookmarkSubscribeRSS Feed
eshupp
Obsidian | Level 7

I am producing a stacked VBAR with SGPLOT (replicating a GCHART) with 24 hours of 5 minute interval data on zOS SAS 9.4 TS1M4.  I only want to display hourly values on the XAXIS (ie: 1, 2, 3,...23) but SGPLOT wants to display a value for each 5 minute time value.  Based on other answers I tried createing a tick format with VALUE entries for each hourly time value ('01:00:00't ... '23:00:00't) translating to a value and OTHER='' and then using the VALUESFORMAT= option on the XAXIS statement but that did not work and the chart displayed unreadable values for each bar.

 

my code:

 

proc sgplot data=vmlpar;
by sysid;
vbar time / response=lnxbusy fill group=vmduser grouporder=ascending stat=sum;
xaxis label='Time of Day' valueattrs=(blue) valuesformat=tick.;

 


vbar chart.gif
4 REPLIES 4
Shmuel
Garnet | Level 18

I'm not sure - can you enter a format statment in the sqgplot  - like 

    format time time2. ;

 

If not, create a new variable to be used on VBAR statement:

     hour = hour(time);

    

DanH_sas
SAS Super FREQ

Since you are using SAS 9.4m3 or greater, try adding TYPE=TIME to your XAXIS statement and see if you get what you want. You can also control the intervals displayed by using the INTERVAL option on the XAXIS statement.

 

Hope this helps!

Dan

eshupp
Obsidian | Level 7
TYPE=TIME in addition to INTERVAL=MINUTE along with the TICKVALUEFORMAT=myformat. resolved my display issue. Thanks to all for the input.
ballardw
Super User

did you try  the INTERVAL=HOUR option on your XAXIS statement?

 

You may also need to use TICKVALUEFORMAT=time2.

 

This does assume that that your variable time is a SAS time value.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1996 views
  • 0 likes
  • 4 in conversation