BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ANLYNG
Pyrite | Level 9

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

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

View solution in original post

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

ANLYNG
Pyrite | Level 9

This solution functions perfect.Thank you very much.

 

SASUserMD
Obsidian | Level 7

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.

Rick_SAS
SAS Super FREQ

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

PaalNavestad
Pyrite | Level 9

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 1453 views
  • 0 likes
  • 5 in conversation