## GANTT diagram

Solved
Frequent Contributor
Posts: 87

# GANTT diagram

I want to show my data in a GANTT diagram. But we do not have SAS/OR so the proc gantt is not possible. I was wondering if it is possible to visualize with sgplot? Anyone has some ideas (code)? My data and thoughts about the plot as specified below:

DATA:

Jobname                            start_time                         end_time

01_XXX_YYY                     24Oct2016:09:04:04        24Oct2016:09:04:08

01_ZZZ_FFF                     24Oct2016:07:34:11         24Oct2016:07:34:18

01_JJJ_KKK                     25Feb2016:20:30:17         25Feb2016:40:30:17

PLOT:

01_XXX_YYY                     -------

01_ZZZ_FFF    ---------

01_JJJ_KKK                                            -------

00.00--------------------------------------------------------------------------------------------------------- 23.59

Accepted Solutions
Solution
‎10-25-2016 02:46 PM
Super User
Posts: 9,599

## Re: GANTT diagram

A highlow plot should be able to do this, here are a lot of examples on the highlow plot with code:

http://blogs.sas.com/content/graphicallyspeaking/?s=highlow

Just a matter of setting your x/y axis correctly, and tweaking some of the options.

All Replies
Solution
‎10-25-2016 02:46 PM
Super User
Posts: 9,599

## Re: GANTT diagram

A highlow plot should be able to do this, here are a lot of examples on the highlow plot with code:

http://blogs.sas.com/content/graphicallyspeaking/?s=highlow

Just a matter of setting your x/y axis correctly, and tweaking some of the options.

Frequent Contributor
Posts: 87

## Re: GANTT diagram

This solution functions perfect.Thank you very much.

Occasional Contributor
Posts: 10

## Re: GANTT diagram

Yes, you can use SGPLOT. You need just two columns, e.g.:

``````DATA TEST1;
INPUT Jobname \$10. Time datetime19.;
CARDS ;
01_JJJ_KKK 24Oct2016:08:30:17
01_JJJ_KKK 24Oct2016:10:30:17
01_XXX_YYY 24Oct2016:11:04:04
01_XXX_YYY 24Oct2016:13:04:08
01_ZZZ_FFF 24Oct2016:15:34:11
01_ZZZ_FFF 24Oct2016:18:34:18
;
RUN;

DATA TEST2;
set TEST1;
format Time datetime19.;
RUN;

PROC SGPLOT DATA=TEST2;
SERIES X=time Y=Jobname / group=Jobname;
yaxis TYPE=DISCRETE;
RUN;``````

Note: I changed the timepoints.

SAS Super FREQ
Posts: 4,241

## Re: GANTT diagram

You can do basic GANTT plots with the HIGHLOW plot. You can use the SCATTER and TEXT statements to add additional information.

Two good articles to read are:

The HIGHLOW plot

The swimmer plot

Contributor
Posts: 69

## Re: GANTT diagram

Hi, you can do something like the following:

• Find the order that you want to view the tasks in. Assign this so the task yo get on to get the highest value and the task you want at bottom get the lowest value. In your example below you must create a table that has
• Value number
• o1_xxx 3
• 01_zzz 2
• 01_JJJ 1
• Create a numeric display format that has the number as the value and the text as the label. Now you can plot the jobname on the y axes using the number, but display using the format
• For each line do a loop going from the start_time to end-time by minute or hour depending on your data. for =1_xxx put value= 3 for 01_yyy put value= 2 and so on.
• Now you have a data set that is missing when the data is not there and 3,2,etc when the task is being done.
• then plot the data as a series X=date_time y=value use a wider than usual pattern. Use the format you created for the value variable.
☑ This topic is solved.