Data visualization with SAS programming

Help wanted: still need the bar shape If there is no value when using proc gchart

Reply
Contributor
Posts: 22

Help wanted: still need the bar shape If there is no value when using proc gchart

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

 

 

Grand Advisor
Posts: 17,474

Re: Help wanted: still need the bar shape If there is no value when using proc gchart

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.

Contributor
Posts: 22

Re: Help wanted: still need the bar shape If there is no value when using proc gchart

Thanks for the suggestions. I will try the way you told me. 

Grand Advisor
Posts: 17,474

Re: Help wanted: still need the bar shape If there is no value when using proc gchart


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. 

Ask a Question
Discussion stats
  • 3 replies
  • 87 views
  • 0 likes
  • 2 in conversation