Program 3.1


/****************************************************************************
* 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.                          *
****************************************************************************/

* SAS procedure for minimum cost flow problem;
option nodate ;
%let _data=’c:/sasor/data3_1.txt’;
%let _title=’Example 3.1. Minimum cost flow problem’;
%let _tail=origin;
%let _head=destination;
%let _cost=cost;
%let _capac=capacity;
%let _demand=demand;
%let _supply=supply;

* 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
arcdata=dcost
arcout=arcout1
nodeout=nodeout1;
tail &_tail;
head &_head;
cost &_cost;
capac &_capac;
demand &_demand;
supply &_supply;
run;

%put &_ORNETFL;
%mend model;

* The report writing macro;
%macro report;
title &_title;
proc print
data=arcout1;
sum _fcost_;
proc print
data=nodeout1;
run;
%mend report;

* A SAS macro for minimum cost capacitated flow problem;

%macro ormcflow;
%data;
%model;
%report;
%mend ormcflow;
%ormcflow;


/****************************************************************************
******************************END of the program*****************************
****************************************************************************/

Permanent link to this article: http://sas-or.com/book/program-3-1

Leave a Reply