Chapter Contents |
Previous |
Next |
The GANTT Procedure |
This example takes advantage of the Output Delivery System (ODS) HTML statement to create a very simple "drill-down" Gantt application beginning from a summary Gantt chart of the "top level" projects in Example 4.23. The objective is to display a detailed Gantt chart of the activities in a subproject when you click on the subproject bar.
In order to be able to click on an activity and invoke an action, you need to add a variable in the schedule data set that associates a URL with each of the activities that you want linked. The following code adds the WEBVAR variable to the LANOUT data set in Example 4.23 to create the LANWEB data set. The LANWEB data set is then sorted by the WBS_CODE variable.
data lanweb; set lanout; length webvar $40; webvar="HREF=#"||trim(wbs_code); run; proc sort data=lanweb; by wbs_code; run;
Notice that the values of the WEBVAR variable are of the form "HREF=#<AnchorName>". For example, for activities with WBS_CODE='0.2', the value of the WEBVAR variable will be 'HREF=#0.2'.
Before creating the charts, you need to specify that the GIF driver be used to create Graphics output. ODS HTML output always creates a "body" file, which is a single HTML document containing the output from one or more procedures and is specified using the FILE= option in the ODS HTML statement.
goptions reset=all device=gif; ods html file="Gantt_Sum.html";
For example, when you click on any of the schedule bars for an activity with WBS_CODE='0.2', you link to an anchor labeled '0.2' in the body file Gantt_Sum.html.
You are now ready to create the summary Gantt chart. You identify the WEBVAR variable to the GANTT procedure using the HTML= option in the CHART statement and invoke the procedure using a WHERE clause to produce a Gantt chart of the top level activities.
/* Create the Summary Gantt Chart with Drill Down Action */ title1 f=swiss 'Gantt Example 26'; title2 f=swiss 'Project Summary Gantt Chart'; proc gantt data=lanweb; id act wbs_code; where proj_lev=1; label act='SUBPROJECT' wbs_code='WBS CODE'; chart / pcompress nojobnum font=swiss duration=days mininterval=week scale=2.5 mindate='01nov89'd maxdate='28feb90'd ref='01nov89:00:00'dt to '01mar90:00:00'dt by dtmonth reflabel html=webvar act=act succ=succ wprec=3; run;
The graph that is displayed when you click on one of the subprojects is determined by the name of the anchor that has been defined for the subproject. Before creating these graphs, you need to define the anchor name in an ODS HTML statement using the ANCHOR= option to add the anchor to the HTML body file. Since you have to create a chart for each subproject, you can automate this process by using a SAS macro.
/* Define the macro to generate the detail charts */ %macro gandet(wbs); ods html anchor=&wbs device=gif; title1 f=swiss 'Gantt Example 26'; title2 f=swiss 'Detail Gantt Chart for WBS='&wbs; proc gantt data=lanweb; id act wbs_code; where index(wbs_code,&wbs)=1; label act='SUBPROJECT' wbs_code='WBS CODE'; chart / pcompress nojobnum font=swiss duration=days mininterval=week scale=2.5 mindate='01nov89'd maxdate='28feb90'd ref='01nov89:00:00'dt to '01mar90:00:00'dt by dtmonth reflabel act=act succ=succ wprec=3; run; %mend; /* Generate each of the detail Gantt Charts */ %gandet('0.1'); %gandet('0.2'); %gandet('0.3'); %gandet('0.4'); %gandet('0.5'); %gandet('0.6');
Finally, use the ODS HTML CLOSE statement to close the body file and stop generating HTML output.
ods html close;
After you have closed the body file, you can display it in a browser window, as shown in Output 4.26.1, to view the output generated by this example.
Output 4.26.1: Summary Gantt Chart
Notice the hand shaped cursor on the 'SITE PREPARATION' bar, which indicates that this bar is a "hot" link. The status bar of the browser also shows that clicking the 'SITE PREPARATION' bar will take you to the location identified by "Gantt_Sum.html#0.4", which is shown in Output 4.26.2.
Output 4.26.2: Detail Gantt Chart for "SITE PREPARATION"Output 4.26.3: Detail Gantt Chart for "SPECIAL HARDWARE"
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.