/***********************************************************************************
* This program is taken from the following book. If using please cite it as: *
* Emrouznejad, A. and W. Ho (2012). Applied Operations Research with SAS, *
* CRC Press: Taylor Francis Ltd, ISBN: 9781439841303. *
* For details please visit: http://www.sas-or.com. *
************************************************************************************/
* A SAS procedure for maximum flow problem: solution to exercise 3.2;
%let _title=’Maximum flow problem: solution to exercise 3.2′;
option nodate;
%let _data=’c:/sasor/Data3_2_exercise.txt’;
%let _sourcenode=’a0′;
%let _sinknode=’a8′;
%let _tail=origin;
%let _head=dest;
%let _lowerb=lowerb;
%let _capac=upperb;
* The data handling macro;
%macro data;
* Import text tab delimited data file to SAS data file;
proc import
datafile=&_data
out=dcost
dbms=tab
replace;
getnames=yes;
run;
%mend data;
* The model building macro;
%macro model;
proc netflow
maxflow
arcdata=dcost
source=&_sourcenode
sink=&_sinknode
arcout=arcout1
nodeout=nodeout1;
minflow &_lowerb;
capac &_capac;
tail &_tail;
head &_head;
run;
%put &_ORNETFL;
%mend model;
* The report writing macro;
%macro report;
title &_title ‘, how to get from ‘ &_sourcenode ‘ to ‘ &_sinknode ;
proc print
data=arcout1;
sum _fcost_;
proc print
data=nodeout1;
run;
%mend report;
* A SAS macro for maximum flow problem;
%macro ormaxflow;
%data;
%model;
%report;
%mend ormaxflow;
%ormaxflow;
/****************************************************************************
******************************END of the program*****************************
****************************************************************************/