BookmarkSubscribeRSS Feed
daisy6
Quartz | Level 8

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

 

 

3 REPLIES 3
Reeza
Super User

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.

daisy6
Quartz | Level 8

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

Reeza
Super User

@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. 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 670 views
  • 0 likes
  • 2 in conversation