ReadMultiRange.gms : Reads a multi-area range and does post processing to eliminate invalid entries

Description

This program illustrates how multiple-area ranges can be handled.
It also does post processing to change invalid entries.


Category : GAMS Data Utilities library


Main file : ReadMultiRange.gms   includes :  ReadMultiRange.gms  UNESCO.xlsx

$onText
   This program illustrates how multiple-area ranges can be handled.
   It also does post processing to change invalid entries.

   
   The Windows GAMS distribution contains several tools to exchange data with MS-Excel:  
   GDX2XLS, GDXXRW, XLS2GMS, and XLSDUMP. While we continue to include all four tools in our 
   distribution, only GDXXRW is under active development.  Therefore, we strongly recommend 
   using GDXXRW for data exchange with Excel.
$offText

$callTool win32.msappavail Excel
$if errorlevel 1 $abort.noError "No Excel available"

set c 'countries' /Algeria,Angola,Benin,Botswana,'Burkina Faso',Burundi,
                   Cameroon,'Cape Verde','Central African Republic',
                   Chad,Comoros,Congo/;

set exp 'percentage distribution of current expenditure' /prim,sec,tert/;

$onEcho > commands.txt
I=UNESCO.xlsx
R=A10,E10:G10,A14:A19,E14:G19
O=UNESCO.inc
B
$offEcho

$call =xls2gms @commands.txt

$onEcho > sedcommands.txt
s/prim\./prim /
s/Sec\./sec /
s/Tert\./tert /
s/\.\.\./   /g
s/\.\/\./   /g
$offEcho

$call sed.exe -f sedcommands.txt UNESCO.inc > UNESCOX.inc

table distr(c,exp)
$include UNESCOX.inc
;

display distr;