Hello SAS experts,
I used proc gchart to get the frequncy of time intervals and if there is no value in one time interval but still need the graph to demonstrate it. How to do?
For example:
data timeinterval;
input id time;
datalines;
111 2440
222 1876
333 2498
444 3956
555 7690
666 6879
777 5463
;
run;
proc format;
value vtime
0 - 1800 ="Up to 00:30 min"
1801 -3600 = "00:31 to 1:00 "
3601 -5400 ="1:01 to 1:30 "
5401 -7200 = "1:31 to 2:00"
7201 - 9000 ="2:01 to 2:30"
>9000 = "Above 2:30"
;
run;
proc gchart data=timeinterval;
format time vtime.;
vbar3D time/discrete noframe shape=block width=4
space=4
outside=freq
raxis=axis1
coutline=CX4D7EBF
woutline=1
autoref clipref;
run;
quit;
I need the bar which interval is "Above 2:30" even the frequency=0;
Thanks
But you don't have that value in your data set. In this case, you should pre-summarize your data to include the values/levels you'll want.
The way to do this is to use PRELOADFMT or CLASSDATA. Other options include manually adding in the level.
Once your data is together you can use HBARPARM or VBARPARM within SGPLOT to graph the data. GCHART is antiquated and I would never recommend developing new graphs using GCHART. SGPLOT gives you a lot more features and better quality graphs.
Thanks for the suggestions. I will try the way you told me.
@daisy6 wrote:
Thanks for the suggestions. I will try the way you told me.
If you can't figure a step out feel free to post back with the code you have so far.
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!
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.