All of the GAMS/MPSGE code summarized in page may be obtained from Thomas Rutherford. This example contains data for Gunnison county, Colorado. Data sets for any state or county in the U.S. may be order from:
Scott Lindall Minnesota Implan Group| overview | The IMPLAN Social Accounting Matrix: An Overview |
| run.bat | DOS batch file to form an check a benchmark dataset |
| chksam.gms | A GAMS program to check consistency of an IMPLAN SAM |
| mapping.gtp | Mapping definitions from IMPLAN to something comparable to GTAP |
| aggr.gms | A GAMS aggregation routine for the IMPLAN database. |
| model.gms | A GAMS/MPSGE model which uses the IMPLAN data. |
S G F I T
1 2 3 4 5
S 1 MAKE SEXPRT
G 2 USE IUSE
F 3 FD FEXPRT
I 4 IMAKE FS TRNSFR IEXPRT
T 5 SIMPRT FIMPRT IIMPRT TRNSHP
Provided in flat ASCII files:
1X2.DAT 4X5.DAT
1X5.DAT 4X7.DAT
1X7.DAT 4X8.DAT
1X8.DAT 5X1.DAT
2X1.DAT 5X3.DAT
2X4.DAT 5X4.DAT
3X1.DAT 5X5.DAT
4X2.DAT 7X1.DAT
4X3.DAT 7X4.DAT
4X4.DAT 8X1.DAT
8X4.DAT
Set names used in the GAMS code:
S INDUSTRIES
1 Dairy Farm Products
...
527 Household Industry-High Income
528 Inventory Valuation Adjustment
G Commodities
3001 Dairy Farm Products
...
3527 Household Industry-High Income
3528 Inventory Valuation Adjustment
F Factors
5001 Employee Compensation
6001 Proprietary Income
7001 Other Property Income
8001 Indirect Business Taxes
I Institutions
10001 Personal consumption-low income households
10002 Personal consumption-medium income households
10003 Personal consumption-high income households
11001 Federal Govt Non-Defense
11002 Federal Govt Defense
11003 Commodity Credit Corporation
12001 State - Local Govt Non-Education
12002 State - Local Govt Education
13001 Enterprises (Corporations)
14001 Gross Private Fixed Investment (Capital)
14002 Inventory Sales - Deletions
T Trade
25001 Foreign trade
28001 Domestic Trade
: This batch file unloads and checks IMPLAN data, aggreates : to a specified mapping, generates an echo-print, : and replicates the benchmark equilibrium in a simple general : equilibrium model: : Check consistency of the data in its original form: pkunzip %190.zip call gams chksam s=sam o=%1.chk pkzip -m -f %190 : Aggregate to a specified mapping and save the dataset: echo $INCLUDE mapping.gtp >mapping call gams aggr r=sam o=%1.agg copy data.agg data.gtp del data.agg : Generate an echoprint and benchmark the generic model: echo $INCLUDE data.gtp >data call gams model s=bmk o=%1.mdl
$TITLE Implan Social Accounting Matrix -- millions of 1990 US$
SET R Rows and columns in the SAM /
* INDUSTRIES = R1
1 Dairy Farm Products
2 Poultry And Eggs
3 Ranch Fed Cattle
4 Range Fed Cattle
5 Cattle Feedlots
6 Sheep Lambs And Goats
7 Hogs Pigs And Swine
8 Other Meat Animal Products
9 Miscellaneous Livestock
10 Cotton
11 Food Grains
12 Feed Grains except Hay & Pasture
13 Hay And Pasture
14 Grass Seeds
15 Tobacco
16 Fruits
17 Tree Nuts
18 Vegetables
19 Sugar Crops
20 Miscellaneous Crops
21 Oil Bearing Crops
22 Forest Products
23 Greenhouse And Nursery Products
24 Forestry Products
25 Commercial Fishing
26 Agricultural Forestry Fishery Ser
27 Landscape And Horticultural Service
28 Iron Ores
29 Copper Ores
30 Lead And Zinc Ores
31 Gold Ores
32 Silver Ores
33 Ferroalloy Ores Except Vanadium
34 Metal Mining Services
35 Uranium-radium-vanadium Ores
36 Metal Ores Not Elswhere Classified
37 Coal Mining
38 Natural Gas & Crude Petroleum exce
39 Natural Gas Liquids
40 Dimension Stone
41 Sand And Gravel
42 Clay Ceramic Refractory Minerals
43 Potash Soda And Borate Minerals
44 Phosphate Rock
45 Chemical Fertilizer Mineral Mining
46 Nonmetallic Minerals (except fuels)
47 Misc. Nonmetallic Minerals N.E.C.
48 New Residential Structures
49 New Industrial And Commercial Build
50 New Utility Structures
51 New Highways And Streets
52 New Farm Structures
53 New Mineral Extraction Facilities
54 New Government Facilities
55 Maintenance And Repair Residental
56 Maintenance And Repair Other Facili
57 Maintenance And Repair Oil And Gas
58 Meat Packing Plants
59 Sausages And Other Prepared Meats
60 Poultry Processing
61 Creamery Butter
62 Cheese Natural And Processed
63 Condensed And Evaporated Milk
64 Ice Cream And Frozen Desserts
65 Fluid Milk
66 Canned Specialties
67 Canned Fruits And Vegetables
68 Dehydrated Food Products
69 Pickles Sauces And Salad Dressing
70 Frozen Fruits Juices And Vegetable
71 Frozen Specialties
72 Flour And Other Grain Mill Products
73 Cereal Preparations
74 Rice Milling
75 Blended And Prepared Flour
76 Wet Corn Milling
77 Dog Cat And Other Pet Food
78 Prepared Feeds N.E.C
79 Bread Cake And Related Products
80 Cookies And Crackers
81 Sugar
82 Confectionery Products
83 Chocolate And Cocoa Products
84 Chewing Gum
85 Salted And Roasted Nuts & Seeds
86 Cottonseed Oil Mills
87 Soybean Oil Mills
88 Vegetable Oil Mills N.E.C
89 Animal And Marine Fats And Oils
90 Shortening And Cooking Oils
91 Malt Beverages
92 Malt
93 Wines Brandy And Brandy Spirits
94 Distilled Liquor Except Brandy
95 Bottled And Canned Soft Drinks
96 Flavoring Extracts And Syrups N.E.
97 Canned And Cured Sea Foods
98 Prepared Fresh Or Frozen Fish Or Se
99 Roasted Coffee
100 Potato Chips & Similar Snacks
101 Manufactured Ice
102 Macaroni And Spaghetti
103 Food Preparations N.E.C
104 Cigarettes
105 Cigars
106 Chewing And Smoking Tobacco
107 Tobacco Stemming And Redrying
108 Broadwoven Fabric Mills And Finishi
109 Narrow Fabric Mills
110 Womens Hosiery Except Socks
111 Hosiery N.E.C
112 Knit Outerwear Mills
113 Knit Underwear Mills
114 Knit Fabric Mills
115 Knitting Mills N.E.C
116 Yarn Mills And Finishing Of Textile
117 Carpets And Rugs
118 Thread Mills
119 Coated Fabrics Not Rubberized
120 Tire Cord And Fabric
121 Nonwoven Fabrics
122 Cordage And Twine
123 Textile Goods N.E.C
124 Apparel Made From Purchased Materia
125 Curtains And Draperies
126 Housefurnishings N.E.C
127 Textile Bags
128 Canvas Products
129 Pleating And Stitching
130 Automotive And Apparel Trimming
131 Schiffi Machine Embroideries
132 Fabricated Textile Products N.E.C.
133 Logging Camps And Logging Contracto
134 Sawmills And Planing Mills General
135 Hardwood Dimension And Flooring Mil
136 Special Product Sawmills N.E.C
137 Millwork
138 Wood Kitchen Cabinets
139 Veneer And Plywood
140 Structural Wood Members N.E.C
141 Wood Containers
142 Wood Pallets And Skids
143 Mobile Homes
144 Prefabricated Wood Buildings
145 Wood Preserving
146 Reconstituted Wood Products
147 Wood Products N.E.C
148 Wood Household Furniture
149 Upholstered Household Furniture
150 Metal Household Furniture
151 Mattresses And Bedsprings
152 Wood Tv And Radio Cabinets
153 Household Furniture N.E.C
154 Wood Office Furniture
155 Metal Office Furniture
156 Public Building Furniture
157 Wood Partitions And Fixtures
158 Metal Partitions And Fixtures
159 Blinds Shades And Drapery Hardwar
160 Furniture And Fixtures N.E.C
161 Pulp Mills
162 Paper Mills Except Building Paper
163 Paperboard Mills
164 Paperboard Containers And Boxes
165 Paper Coated & Laminated Packaging
166 Paper Coated & Laminated N.E.C.
167 Bags Plastic
168 Bags Paper
169 Die-cut Paper And Board
170 Sanitary Paper Products
171 Envelopes
172 Stationery Products
173 Converted Paper Products N.E.C
174 Newspapers
175 Periodicals
176 Book Publishing
177 Book Printing
178 Miscellaneous Publishing
179 Commercial Printing
180 Manifold Business Forms
181 Greeting Card Publishing
182 Blankbooks And Looseleaf Binders
183 Bookbinding & Related
184 Typesetting
185 Plate Making
186 Alkalies & Chlorine
187 Industrial Gases
188 Inorganic Pigments
189 Inorganic Chemicals Nec.
190 Cyclic Crudes Interm. & Indus. Org
191 Plastics Materials And Resins
192 Synthetic Rubber
193 Cellulosic Man-made Fibers
194 Organic Fibers Noncellulosic
195 Drugs
196 Soap And Other Detergents
197 Polishes And Sanitation Goods
198 Surface Active Agents
199 Toilet Preparations
200 Paints And Allied Products
201 Gum And Wood Chemicals
202 Nitrogenous And Phosphatic Fertaliz
203 Fertilizers Mixing Only
204 Agricultural Chemicals N.E.C.
205 Adhesives And Sealants
206 Explosives
207 Printing Ink
208 Carbon Black
209 Chemical Preparations N.E.C
210 Petroleum Refining
211 Paving Mixtures And Blocks
212 Asphalt Felts And Coatings
213 Lubricating Oils And Greases
214 Petroleum And Coal Products N.E.C.
215 Tires And Inner Tubes
216 Rubber And Plastics Footwear
217 Rubber And Plastics Hose And Beltin
218 Gaskets Packing And Sealing Device
219 Fabricated Rubber Products N.E.C.
220 Miscellaneous Plastics Products
221 Leather Tanning And Finishing
222 Footwear Cut Stock
223 House Slippers
224 Shoes Except Rubber
225 Leather Gloves And Mittens
226 Luggage
227 Womens Handbags And Purses
228 Personal Leather Goods
229 Leather Goods N.E.C
230 Glass And Glass Products Exc Conta
231 Glass Containers
232 Cement Hydraulic
233 Brick And Structural Clay Tile
234 Ceramic Wall And Floor Tile
235 Clay Refractories
236 Structural Clay Products N.E.C
237 Vitreous Plumbing Fixtures
238 Vitreous China Food Utensils
239 Fine Earthenware Food Utensils
240 Porcelain Electrical Supplies
241 Pottery Products N.E.C
242 Concrete Block And Brick
243 Concrete Products N.E.C
244 Ready-mixed Concrete
245 Lime
246 Gypsum Products
247 Cut Stone And Stone Products
248 Abrasive Products
249 Asbestos Products
250 Minerals Ground Or Treated
251 Mineral Wool
252 Nonclay Refractories
253 Nonmetallic Mineral Products N.E.C
254 Blast Furnaces And Steel Mills
255 Electrometallurgical Products
256 Steel Wire And Related Products
257 Cold Finishing Of Steel Shapes
258 Steel Pipe And Tubes
259 Iron And Steel Foundries
260 Primary Copper
261 Primary Aluminum
262 Primary Nonferrous Metals N.E.C.
263 Secondary Nonferrous Metals
264 Copper Rolling And Drawing
265 Aluminum Rolling And Drawing
266 Nonferrous Rolling And Drawing N.E
267 Nonferrous Wire Drawing And Insulat
268 Aluminum Foundries
269 Brass Bronze And Copper Foundries
270 Nonferrous Castings N.E.C.
271 Metal Heat Treating
272 Primary Metal Products N.E.C.
273 Metal Cans
274 Metal Barrels Drums And Pails
275 Cutlery
276 Hand And Edge Tools N.E.C.
277 Hand Saws And Saw Blades
278 Hardware N.E.C.
279 Metal Sanitary Ware
280 Plumbing Fixture Fittings And Trim
281 Heating Equipment Except Electric
282 Fabricated Structural Metal
283 Metal Doors Sash And Trim
284 Fabricated Plate Work (Boiler Shops
285 Sheet Metal Work
286 Architectural Metal Work
287 Prefabricated Metal Buildings
288 Miscellaneous Metal Work
289 Screw Machine Products And Bolt Et
290 Iron And Steel Forgings
291 Nonferrous Forgings
292 Automotive Stampings
293 Crowns And Closures
294 Metal Stampings N.E.C.
295 Plating And Polishing
296 Metal Coating And Allied Services
297 Small Arms Ammunition
298 Ammunition Except For Small Arms
299 Small Arms
300 Other Ordnance And Accessories
301 Industrial And Fluid Valves
302 Steel Springs Except Wire
303 Pipe Valves And Pipe Fittings
304 Miscellaneous Fabricated Wire Produ
305 Metal Foil And Leaf
306 Fabricated Metal Products N.E.C.
307 Steam Engines And Turbines
308 Internal Combustion Engines N.E.C.
309 Farm Machinery And Equipment
310 Lawn And Garden Equipment
311 Construction Machinery And Equipmen
312 Mining Machinery Except Oil Field
313 Oil Field Machinery
314 Elevators And Moving Stairways
315 Conveyors And Conveying Equipment
316 Hoists Cranes And Monorails
317 Industrial Trucks And Tractors
318 Machine Tools Metal Cutting Types
319 Machine Tools Metal Forming Types
320 Industrial Patterns
321 Special Dies And Tools And Accessor
322 Power Driven Hand Tools
323 Rolling Mill Machinery
324 Welding Apparatus
325 Metalworking Machinery N.E.C.
326 Textile Machinery
327 Woodworking Machinery
328 Paper Industries Machinery
329 Printing Trades Machinery
330 Food Products Machinery
331 Special Industry Machinery N.E.C.
332 Pumps And Compressors
333 Ball And Roller Bearings
334 Blowers And Fans
335 Packaging Machinery
336 Power Transmission Equipment
337 Industrial Furnaces And Ovens
338 General Industrial Machinery N.E.C
339 Electronic Computers
340 Computer Storage Devices
341 Computer Terminals
342 Computer Peripheral Equipment N.E.
343 Calculating And Accounting Machines
344 Typewriters And Office Machines
345 Automatic Merchandising Machine
346 Commercial Laundry Equipment
347 Refrigeration And Heating Equipment
348 Measuring And Dispensing Pumps
349 Service Industry Machines N.E.C.
350 Carburetors Pistons Rings Valves
351 Fluid Power Cylinders & Actuators
352 Fluid Power Pumps & Motors
353 Scales And Balances
354 Industrial Machines N.E.C.
355 Transformers
356 Switchgear And Switchboard Apparatu
357 Motors And Generators
358 Carbon And Graphite Products
359 Relays & Industrial Controls
360 Electrical Industrial Apparatus N.
361 Household Cooking Equipment
362 Household Refrigerators And Freezer
363 Household Laundry Equipment
364 Electric Housewares And Fans
365 Household Vacuum Cleaners
366 Household Appliances N.E.C.
367 Electric Lamps
368 Wiring Devices
369 Lighting Fixtures And Equipment
370 Radio And Tv Receiving Sets
371 Phonograph Records And Tape
372 Telephone And Telegraph Apparatus
373 Radio And TV Communication Equipmen
374 Communications Equipment N.E.C.
375 Electron Tubes
376 Printed Circuit Boards
377 Semiconductors And Related Devices
378 Electronic Components N.E.C.
379 Storage Batteries
380 Primary Batteries Dry And Wet
381 Engine Electrical Equipment
382 Magnetic & Optical Recording Media
383 Electrical Equipment N.E.C.
384 Motor Vehicles
385 Truck And Bus Bodies
386 Motor Vehicle Parts And Accessories
387 Truck Trailers
388 Motor Homes
389 Aircraft
390 Aircraft And Missile Engines And Pa
391 Aircraft And Missile Equipment N.E
392 Ship Building And Repairing
393 Boat Building And Repairing
394 Railroad Equipment
395 Motorcycles Bicycles And Part
396 Complete Guided Missiles
397 Travel Trailers And Camper
398 Tanks And Tank Components
399 Transportation Equipment N.E.C.
400 Search & Navigation Equipment
401 Laboratory Apparatus & Furniture
402 Automatic Temperature Controls
403 Mechanical Measuring Devices
404 Instruments To Measure Electricity
405 Analytical Instruments
406 Optical Instruments & Lenses
407 Surgical And Medical Instruments
408 Surgical Appliances And Supplies
409 Dental Equipment And Supplies
410 X-ray Apparatus
411 Electromedical Apparatus
412 Ophthalmic Goods
413 Photographic Equipment And Supplies
414 Watches Clocks And Parts
415 Jewelry Precious Metal
416 Silverware And Plated Ware
417 Jewelers Materials And Lapidary Wor
418 Musical Instruments
419 Dolls
420 Games Toys And Childrens Vehicles
421 Sporting And Athletic Goods N.E.C.
422 Pens And Mechanical Pencils
423 Lead Pencils And Art Goods
424 Marking Devices
425 Carbon Paper And Inked Ribbons
426 Costume Jewelery
427 Fasteners Buttons Needles Pins
428 Brooms And Brushes
429 Signs And Advertising Displays
430 Burial Caskets And Vaults
431 Hard Surface Floor Coverings
432 Manufacturing Industries N.E.C.
433 Railroads And Related Services
434 Local Interurban Passenger Transit
435 Motor Freight Transport And Warehou
436 Water Transportation
437 Air Transportation
438 Pipe Lines Except Natural Gas
439 Arrangement Of Passenger Transporta
440 Transportation Services
441 Communications Except Radio And TV
442 Radio And Tv Broadcasting
443 Electric Services
444 Gas Production And Distribution
445 Water Supply And Sewerage Systems
446 Sanitary Services And Steam Supply
447 Wholesale Trade
448 Building Materials & Gardening Supp
449 General Merchandise Stores
450 Food Stores
451 Automotive Dealers & Service Statio
452 Apparel & Accessory Stores
453 Furniture & Home Furnishings Stores
454 Eating & Drinking
455 Miscellaneous Retail
456 Banking
457 Credit Agencies
458 Security And Commodity Brokers
459 Insurance Carriers
460 Insurance Agents And Brokers
461 Owner-occupied Dwellings
462 Real Estate
463 Hotels And Lodging Places
464 Laundry Cleaning And Shoe Repair
465 Portrait And Photographic Studios
466 Beauty And Barber Shops
467 Funeral Service And Crematories
468 Miscellaneous Personal Services
469 Advertising
470 Other Business Services
471 Photofinishing Commercial Photogra
472 Services To Buildings
473 Equipment Rental And Leasing
474 Personnel Supply Services
475 Computer And Data Processing Servic
476 Detective And Protective Services
477 Automobile Rental And Leasing
478 Automobile Parking And Car Wash
479 Automobile Repair And Services
480 Electrical Repair Service
481 Watch Clock Jewelry And Furniture
482 Miscellaneous Repair Shops
483 Motion Pictures
484 Theatrical Producers Bands Etc.
485 Bowling Alleys And Pool Halls
486 Commercial Sports Except Racing
487 Racing And Track Operation
488 Amusement And Recreation Services
489 Membership Sports And Recreation Cl
490 Doctors And Dentists
491 Nursing And Protective Care
492 Hospitals
493 Other Medical And Health Services
494 Legal Services
495 Elementary And Secondary Schools
496 Colleges Universities Schools
497 Other Educational Services
498 Job Trainings & Related Services
499 Child Day Care Services
500 Social Services N.E.C.
501 Residential Care
502 Other Nonprofit Organizations
503 Business Associations
504 Labor And Civic Organizations
505 Religious Organizations
506 Engineering Architectural Services
507 Accounting Auditing And Bookkeepin
508 Management And Consulting Services
509 Research Development & Testing Ser
510 Local Government Passenger Transit
511 State And Local Electric Utilities
512 Other State And Local Govt Enterpri
513 U.S. Postal Service
514 Federal Electric Utilities
515 Other Federal Government Enterprise
516 Noncomparable Imports
517 Scrap
518 Used And Secondhand Goods
519 Federal Government - Defense
520 Federal Government - Non-Defense
521 Commodity Credit Corporation
522 State & Local Government - Educatio
523 State & Local Government - Non-Educ
524 Rest Of The World Industry
525 Household Industry-Low Income
526 Household Industry-Medium Income
527 Household Industry-High Income
528 Inventory Valuation Adjustment
* COMMODITIES = R2
3001 Dairy Farm Products
3002 Poultry And Eggs
...
3526 Household Industry-Medium Income
3527 Household Industry-High Income
3528 Inventory Valuation Adjustment
* FACTORS = R3
5001 Employee Compensation
6001 Proprietary Income
7001 Other Property Income
8001 Indirect Business Taxes
* INSTITUTIONS = R4
10001 Personal consumption-low income households
10002 Personal consumption-medium income households
10003 Personal consumption-high income households
11001 Federal Govt Non-Defense
11002 Federal Govt Defense
11003 Commodity Credit Corporation
12001 State - Local Govt Non-Education
12002 State - Local Govt Education
13001 Enterprises (Corporations)
14001 Gross Private Fixed Investment (Capital)
14002 Inventory Sales - Deletions
* R5: Trade
25001 Foreign trade
28001 Domestic Trade
/;
* Declare the 5 subsets used to partition the SAM:
SET R1(R) Industries /1*528/,
R2(R) Commodities /3001*3528/,
R3(R) Factors / 5001, 6001, 7001, 8001 /
R4(R) Institutions / 10001,10002,10003,11001,11002,11003,12001,
12002,13001,14001,14002/
R5(R) Trade / 25001 Foreign, 28001 Domestic/;
ALIAS (R,C), (R1,C1), (R2,C2), (R3,C3), (R4,C4), (R5,C5);
ALIAS (S,R1), (G,R2), (F,R3), (I,R4), (T,R5);
* Read the data:
PARAMETER SAM(R,C) Social Accounting Matrix (everything) /
* S G F I T
* 1 2 3 4 5
* S 1 MAKE SEXPRT
* G 2 USE IUSE
* F 3 FD FEXPRT
* I 4 IMAKE FS TRNSFR IEXPRT
* T 5 SIMPRT FIMPRT IIMPRT TRNSHP
$INCLUDE 2x1.dat
$INCLUDE 3x1.dat
$INCLUDE 5x1.dat
$INCLUDE 1x2.dat
$INCLUDE 4x2.dat
$INCLUDE 4x3.dat
$INCLUDE 5x3.dat
$INCLUDE 2x4.dat
$INCLUDE 4x4.dat
$INCLUDE 5x4.dat
$INCLUDE 1x5.dat
$INCLUDE 4x5.dat
$INCLUDE 5x5.dat
/;
* Read the satellite tables:
PARAMETER FEXPORT(*,*) Foreign commodity exports /
xxx.xxx 0
$INCLUDE 1x7.dat
$INCLUDE 4x7.dat
/;
PARAMETER DEXPORT(*,*) Domestic commodity exports /
xxx.xxx 0
$INCLUDE 1x8.dat
$INCLUDE 4x8.dat
/;
PARAMETER FIMPORT(*,*) Foreign commodity imports /
xxx.xxx 0
$INCLUDE 7x1.dat
$INCLUDE 7x4.dat
/;
PARAMETER DIMPORT(*,*) Domestic commodity imports /
xxx.xxx 0
$INCLUDE 8x1.dat
$INCLUDE 8x4.dat
/;
* Declare and assign some check sums, using ROUND in order
* to ignore trivial imbalances:
PARAMETER
SAM_CHK(R) Row and column check sums for the full SAM
EXPORT_CHK Consistency check of SAM with export tables,
IMPORT_CHK Consistency check of SAM with import tables;
SAM_CHK(R) = ROUND(SUM(C, SAM(R,C)-SAM(C,R)), 5);
EXPORT_CHK(S,"F") = round( SAM(S,"25001") - SUM(G, FEXPORT(S,G)), 5);
EXPORT_CHK(S,"D") = round( SAM(S,"28001") - SUM(G, DEXPORT(S,G)), 5);
EXPORT_CHK(I,"F") = round( SAM(I,"25001") - SUM(G, FEXPORT(I,G)), 5);
EXPORT_CHK(I,"D") = round( SAM(I,"28001") - SUM(G, DEXPORT(I,G)), 5);
IMPORT_CHK(S,"F") = round( SAM("25001",S) - SUM(G, FIMPORT(G,S)), 5);
IMPORT_CHK(S,"D") = round( SAM("28001",S) - SUM(G, DIMPORT(G,S)), 5);
IMPORT_CHK(I,"F") = round( SAM("25001",I) - SUM(G, FIMPORT(G,I)), 5);
IMPORT_CHK(I,"D") = round( SAM("28001",I) - SUM(G, DIMPORT(G,I)), 5);
* Retrieve capital flows (balance of payments deficit):
PARAMETER BOPDEF(*) Balance of payments deficit;
BOPDEF("FTRD") = EXPORT_CHK("14001","F") - IMPORT_CHK("14001","F");
BOPDEF("DTRD") = EXPORT_CHK("14001","D") - IMPORT_CHK("14001","D");
DISPLAY BOPDEF;
DISPLAY SAM_CHK, EXPORT_CHK, IMPORT_CHK;
$STITLE Sector mapping from IMPLAN to something comparable to GTAP * This is an aggregation mapping file which is read by AGGR.GMS. SET J Aggregated SAM accounts / NGC Non-grain crops, LIV Livestock, GRN All grains FSH Fishing + Forestry CNS Construction, MET Meat products, MIL Milk products, OFP Other food products, B_T Beverages and tobacco, TEX Textiles, LUM Lumber and wood, PPP Pulp and paper, CRP Chemicals rubber and plastics, P_C Petroleum and coal products, LEA Leather goods, NMM Non-metallic mineral products, I_S Primary ferrous metals, NFM Non-ferrous metals, FMP Fabricated metal products, OME Machinery and equipment, OMF Other manufacturing products, T_T Trade and transport, OSP Other services (private), OSG Other services (public), * The following labels are always used: EMPL Employee Compensation (5001) PROP Proprietary Income (6001) OTHP Other Property Income (7001) BTAX Indirect Business Taxes (8001) LOW Personal consumption-low income households (10001) MED Personal consumption-medium income households (10002) HGH Personal consumption-high income households (10003) FND Federal Govt Non-Defense (11001) FDF Federal Govt Defense (11002) CCC Commodity Credit Corporation (11003) SLN State Local Govt Non-Education (12001) SLE State Local Govt Education (12002) ENT Enterprises (Corporations) (13001) INV Gross Private Fixed Investment (Capital) (14001) STK Inventory Sales Deletions (14002) FTRD Foreign Trade (25001) DTRD Domestic Trade (28001) /; $EOLCOM ! SET MAP(J,R) / NGC.( ! Non-grain crops, 1 ! Dairy Farm Products ... 24 ! Forestry Products ), LIV.( ! Livestock, 3 ! Ranch Fed Cattle ... 9 ! Miscellaneous Livestock ), GRN.( ! All grains 11 ! Food Grains ... 76 ! Wet Corn Milling ), FSH.( ! Fishing + Forestry, 25 ! Commercial Fishing ... 27 ! Landscape And Horticultural Service ), CNS.( ! Construction 48 ! New Residential Structures ... 58 ! Meat Packing Plants ), MET.( ! Meat products, 59 ! Sausages And Other Prepared Meats ... 98 ! Prepared Fresh Or Frozen Fish Or Se ), MIL.( ! Milk products, 61 ! Creamery Butter ... 65 ! Fluid Milk ), OFP.( ! Other food products, 66 ! Canned Specialties ... 103 ! Food Preparations N.E.C ), B_T.( ! Beverages and tobacco, 15 ! Tobacco ... 107 ! Tobacco Stemming And Redrying ), TEX.( ! Textiles, 108 ! Broadwoven Fabric Mills And Finishi ... 132 ! Fabricated Textile Products N.E.C. ), LUM.( ! Lumber and wood, 133 ! Logging Camps And Logging Contracto ... 157 ! Wood Partitions And Fixtures ), PPP.( ! Pulp and paper, 161 ! Pulp Mills ... 185 ! Plate Making ), CRP.( ! Chemicals rubber and plastics, 40 ! Dimension Stone ... 220 ! Miscellaneous Plastics Products ), P_C.( ! Petroleum and coal products, 37 ! Coal Mining ... 214 ! Petroleum And Coal Products N.E.C. ), LEA.( ! Leather goods, 221 ! Leather Tanning And Finishing ... 229 ! Leather Goods N.E.C ), NMM.( ! Non-metallic mineral products, 46 ! Nonmetallic Minerals (except fuels) ... 253 ! Nonmetallic Mineral Products N.E.C ), I_S.( ! Primary ferrous metals, 28 ! Iron Ores ... 259 ! Iron And Steel Foundries ), NFM.( ! Non-ferrous metals, 260 ! Primary Copper ... 270 ! Nonferrous Castings N.E.C. ), FMP.( ! Fabricated metal products, 150 ! Metal Household Furniture ... 306 ! Fabricated Metal Products N.E.C. ) OME.( ! Machinery and equipment, 307 ! Steam Engines And Turbines ... 413 ! Photographic Equipment And Supplies ), OMF.( ! Other manufacturing products, 414 ! Watches Clocks And Parts ... 524 ! Rest Of The World Industry ), T_T.( ! Trade and transport, 447 ! Wholesale Trade ... 455 ! Miscellaneous Retail ), OSP.( ! Other services (private), 433 ! Railroads And Related Services ... 527 ! Household Industry-High Income ), OSG.( ! Other services (public), 492 ! Hospitals ... 523 ! State & Local Government - Non-Educ ) EMPL.5001 Employee Compensation PROP.6001 Proprietary Income OTHP.7001 Other Property Income BTAX.8001 Indirect Business Taxes LOW.10001 Personal consumption-low income households MED.10002 Personal consumption-medium income households HGH.10003 Personal consumption-high income households FND.11001 Federal Govt Non-Defense FDF.11002 Federal Govt Defense CCC.11003 Commodity Credit Corporation SLN.12001 State Local Govt Non-Education SLE.12002 State Local Govt Education ENT.13001 Enterprises (Corporations) INV.14001 Gross Private Fixed Investment (Capital) STK.14002 Inventory Sales Deletions FTRD.25001 Foreign Trade DTRD.28001 Domestic Trade /; ALIAS (J,JJ); * Add commodities to the mapping in accordance with the industry * mapping: LOOP((S,G)$(ORD(G) EQ ORD(S)), MAP(J,G) = MAP(J,S););
$TITLE Aggregation routine for the IMPLAN database.
FILE CON;
PUT CON//;
* Read the aggregation mapping:
PUTCLOSE CON, 'Reading mapping...'/;
$INCLUDE MAPPING
PUTCLOSE CON, 'Checking mapping...'/;
SET MAPERROR(*) Identifies rows which are improperly mapped;
MAPERROR(R) = YES$(SUM(J$MAP(J,R), 1) - 1);
ABORT$CARD(MAPERROR) " Type 1 error in mapping -- good not mapped:",MAPERROR;
MAPERROR(J) = YES$(SUM(R$MAP(J,R), 1) EQ 0);
ABORT$CARD(MAPERROR) " Type 2 error in mapping -- target not used:",MAPERROR;
SET SJ(J), GJ(J), FJ(J), IJ(J), TJ(J);
SJ(J) = YES$SUM(S$MAP(J,S),1);
GJ(J) = YES$SUM(G$MAP(J,G),1);
FJ(J) = YES$SUM(F$MAP(J,F),1);
IJ(J) = YES$SUM(I$MAP(J,I),1);
TJ(J) = YES$SUM(T$MAP(J,T),1);
* Aggregate submatrices and assign new labels:
PARAMETER
MAKE(J,JJ) Domestic industry make matrix
SEXPRT(J,JJ) Aggregate industry exports
USE(J,JJ) Domestic industry use matrix
IUSE(J,JJ) Domestic institutional use matrix
FD(J,JJ) Factor input matrix : industry use of factors
FEXPRT(J,JJ) Factor exports
IMAKE(J,JJ) Domestic institutional make matrix
FS(J,JJ) Factor disbursement matrix
TRNSFER(J,JJ) Inter-institutional transfers
IEXPRT(J,JJ) Institutional exports
SIMPRT(J,JJ) Industry imports
FIMPRT(J,JJ) Factor imports
IIMPRT(J,JJ) Institutional imports
TRNSHP(J,JJ) Transhipments
EXPORT(J,J,J) Exports by sector - commodity - destination
IMPORT(J,J,J) Imports by commodity - sector - source;
ALIAS (I,II), (T,TT), (IJ,IIJ),(TJ,TTJ);
PUTCLOSE CON, 'Aggregating MAKE...'/;
MAKE(SJ,GJ) = 0;
LOOP((SJ,S)$MAP(SJ,S), LOOP((GJ,G)$(SAM(S,G)$MAP(GJ,G)),
MAKE(SJ,GJ) = MAKE(SJ,GJ) + SAM(S,G); ));
PUTCLOSE CON, 'Aggregating SEXPRT...'/;
SEXPRT(SJ,TJ) = SUM((S,T)$(SAM(S,T)$(MAP(SJ,S)*MAP(TJ,T))),SAM(S,T));
PUTCLOSE CON, 'Aggregating USE...'/;
USE(GJ,SJ) = SUM((G,S)$(SAM(G,S)$(MAP(GJ,G)*MAP(SJ,S))),SAM(G,S));
PUTCLOSE CON, 'Aggregating IUSE...'/;
IUSE(GJ,IJ) = SUM((G,I)$(SAM(G,I)$(MAP(GJ,G)*MAP(IJ,I))),SAM(G,I));
PUTCLOSE CON, 'Aggregating FD...'/;
FD(FJ,SJ) = SUM((F,S)$(SAM(F,S)$(MAP(FJ,F)*MAP(SJ,S))),SAM(F,S));
PUTCLOSE CON, 'Aggregating FEXPRT..'/;
FEXPRT(FJ,TJ) = SUM((F,T)$(SAM(F,T)$(MAP(FJ,F)*MAP(TJ,T))),SAM(F,T));
PUTCLOSE CON, 'Aggregating IMAKE..'/;
IMAKE(IJ,GJ) = SUM((I,G)$(SAM(I,G)$(MAP(IJ,I)*MAP(GJ,G))),SAM(I,G));
PUTCLOSE CON, 'Aggregating FS..'/;
FS(IJ,FJ) = SUM((I,F)$(SAM(I,F)$(MAP(IJ,I)*MAP(FJ,F))),SAM(I,F));
PUTCLOSE CON, 'Aggregating TRNSFER..'/;
TRNSFER(IJ,IIJ) = SUM((I,II)$(SAM(I,II)$(MAP(IJ,I)*MAP(IIJ,II))),SAM(I,II));
PUTCLOSE CON, 'Aggregating IEXPRT..'/;
IEXPRT(IJ,TJ) = SUM((I,T)$(SAM(I,T)$(MAP(IJ,I)*MAP(TJ,T))),SAM(I,T));
PUTCLOSE CON, 'Aggregating SIMPRT..'/;
SIMPRT(TJ,SJ) = SUM((T,S)$(SAM(T,S)$(MAP(TJ,T)*MAP(SJ,S))),SAM(T,S));
PUTCLOSE CON, 'Aggregating FIMPRT..'/;
FIMPRT(TJ,FJ) = SUM((T,F)$(SAM(T,F)$(MAP(TJ,T)*MAP(FJ,F))),SAM(T,F));
PUTCLOSE CON, 'Aggregating IIMPRT..'/;
IIMPRT(TJ,IJ) = SUM((T,I)$(SAM(T,I)$(MAP(TJ,T)*MAP(IJ,I))),SAM(T,I));
PUTCLOSE CON, 'Aggregating TRNSHP..'/;
TRNSHP(TJ,TTJ) = SUM((T,TT)$(SAM(T,TT)$(MAP(TJ,T)*MAP(TTJ,TT))),SAM(T,TT));
PUTCLOSE CON, 'Aggregating EXPORT..'/;
EXPORT(J,GJ,"FTRD") = SUM((S,G)$(MAP(J,S)*MAP(GJ,G)), FEXPORT(S,G))
+ SUM((I,G)$(MAP(J,I)*MAP(GJ,G)), FEXPORT(I,G));
EXPORT(J,GJ,"DTRD") = SUM((S,G)$(MAP(J,S)*MAP(GJ,G)), DEXPORT(S,G))
+ SUM((I,G)$(MAP(J,I)*MAP(GJ,G)), DEXPORT(I,G));
PUTCLOSE CON, 'Aggregating IMPORT..'/;
IMPORT(GJ,J,"FTRD") = SUM((G,S)$(MAP(GJ,G)*MAP(J,S)), FIMPORT(G,S))
+ SUM((G,I)$(MAP(GJ,G)*MAP(J,I)), FIMPORT(G,I));
IMPORT(GJ,J,"DTRD") = SUM((G,S)$(MAP(GJ,G)*MAP(J,S)), DIMPORT(G,S))
+ SUM((G,I)$(MAP(GJ,G)*MAP(J,I)), DIMPORT(G,I));
PUTCLOSE CON, 'Writing DATA.AGG..'/;
FILE KDATA /DATA.AGG/;
PUT KDATA;
KDATA.LW=0;
* Suppress sector and goods names for vacuous entries:
SET DROPS(J) Sectors which are not used,
DROPG(J) Goods which are not used;
DROPS(J)$SJ(J) = YES$(SUM(GJ,MAKE(J,GJ))+SUM(TJ,SEXPRT(J,TJ)) EQ 0);
DROPG(J)$GJ(J) = YES$(SUM(SJ,MAKE(SJ,J))+SUM((JJ,TJ),IMPORT(J,JJ,TJ)) EQ 0);
DISPLAY DROPS, DROPG;
SJ(J)$DROPS(J) = NO;
GJ(J)$DROPG(J) = NO;
PUT 'SET S Sectors /'/;
LOOP(J$SJ(J), PUT J.TL,' ',JJ.TE(J)/;); PUT '/;'/;
PUT 'SET G Goods /'/;
LOOP(J$GJ(J), PUT J.TL,' ',JJ.TE(J)/;); PUT '/;'/;
PUT 'SET F Factors /'/;
LOOP(J$FJ(J), PUT J.TL,' ',JJ.TE(J)/;); PUT '/;'/;
PUT 'SET T Trade partners /'/;
LOOP(J$TJ(J), PUT J.TL,' ',JJ.TE(J)/;); PUT '/;'/;
PUT 'SET I Institutions /'/;
LOOP(J$IJ(J), PUT J.TL,' ',JJ.TE(J)/;); PUT '/;'/;
PUT 'ALIAS (I,II), (T,TT), (G,GG), (S,SS), (F,FF);'/;
PUT 'PARAMETER MAKE(S,G) Domestic industry make matrix /'/;
$BATINCLUDE gams2txt MAKE
PUT '/;'/;
IF (SUM((J,JJ)$SEXPRT(J,JJ),1),
PUT 'PARAMETER SEXPRT(S,T) Aggregate industry exports /'/;
$BATINCLUDE gams2txt SEXPRT
PUT '/;'/;
ELSE
PUT 'PARAMETER SEXPRT(S,T) Aggregate industry exports; SEXPRT(S,T)=0;'/;
);
IF (SUM((J,JJ)$USE(J,JJ),1),
PUT 'PARAMETER USE(G,S) Industry use matrix /'/;
$BATINCLUDE gams2txt USE
PUT '/;'/;
ELSE
PUT 'PARAMETER USE(G,S) Industry use matrix; USE(G,S)=0;'/;
);
IF (SUM((J,JJ)$IUSE(J,JJ),1),
PUT 'PARAMETER IUSE(G,I) Institutional use matrix /'/;
$BATINCLUDE gams2txt IUSE
PUT '/;'/;
ELSE
PUT 'PARAMETER IUSE(G,I) Institutional use matrix; IUSE(G,I)=0;'/;
);
IF (SUM((J,JJ)$FD(J,JJ),1),
PUT 'PARAMETER FD(F,S) Industry use of factors /'/;
$BATINCLUDE gams2txt FD
PUT '/;'/;
ELSE
PUT 'PARAMETER FD(F,S) Industry use of factors; FD(F,S)=0;'/;
);
IF (SUM((J,JJ)$FEXPRT(J,JJ),1),
PUT 'PARAMETER FEXPRT(F,T) Factor exports /'/;
$BATINCLUDE gams2txt FEXPRT
PUT '/;'/;
ELSE
PUT 'PARAMETER FEXPRT(F,T) Factor exports; FEXPRT(F,T)=0;'/;
);
IF (SUM((J,JJ)$IMAKE(J,JJ),1),
PUT 'PARAMETER IMAKE(I,G) Institutional make matrix /'/;
$BATINCLUDE gams2txt IMAKE
PUT '/;'/;
ELSE
PUT 'PARAMETER IMAKE(I,G) Institutional make matrix; IMAKE(I,G)=0;'/;
);
IF (SUM((J,JJ)$FS(J,JJ),1),
PUT 'PARAMETER FS(I,F) Factor disbursement matrix /'/;
$BATINCLUDE gams2txt FS
PUT '/;'/;
ELSE
PUT 'PARAMETER FS(I,F) Factor disbursement matrix; FS(I,F)=0;'/;
);
IF (SUM((J,JJ)$TRNSFER(J,JJ),1),
PUT 'PARAMETER TRNSFER(I,II) Inter-institutional transfers /'/;
$BATINCLUDE gams2txt TRNSFER
PUT '/;'/;
ELSE
PUT 'PARAMETER TRNSFER(I,II) Inter-institutional transfers; '/
'TRNSFER(I,II)=0;'/;
);
IF (SUM((J,JJ)$IEXPRT(J,JJ),1),
PUT 'PARAMETER IEXPRT(I,T) Institutional exports /'/;
$BATINCLUDE gams2txt IEXPRT
PUT '/;'/;
ELSE
PUT 'PARAMETER IEXPRT(I,T) Institutional exports; IEXPRT(I,T)=0;'/;
);
IF (SUM((J,JJ)$SIMPRT(J,JJ),1),
PUT 'PARAMETER SIMPRT(T,S) Industry imports /'/;
$BATINCLUDE gams2txt SIMPRT
PUT '/;'/;
ELSE
PUT 'PARAMETER SIMPRT(T,S) Industry imports; SIMPRT(T,S)=0;'/;
);
IF (SUM((J,JJ)$FIMPRT(J,JJ),1),
PUT 'PARAMETER FIMPRT(T,F) Factor imports /'/;
$BATINCLUDE gams2txt FIMPRT
PUT '/;'/;
ELSE
PUT 'PARAMETER FIMPRT(T,F) Factor imports; FIMPRT(T,F)=0;'/;
);
IF (SUM((J,JJ)$IIMPRT(J,JJ),1),
PUT 'PARAMETER IIMPRT(T,I) Institutional imports /'/;
$BATINCLUDE gams2txt IIMPRT
PUT '/;'/;
ELSE
PUT 'PARAMETER IIMPRT(T,I) Institutional imports; IIMPRT(T,I)=0; /'/;
);
IF (SUM((J,JJ)$TRNSHP(J,JJ),1),
PUT 'PARAMETER TRNSHP(T,TT) Transhipments /'/;
$BATINCLUDE gams2txt TRNSHP
PUT '/;'/;
ELSE
PUT 'PARAMETER TRNSHP(T,TT) Transhipments; TRNSHP(T,TT)=0;'/;
);
PUT 'PARAMETER EXPORT(*,G,T) Commodity exports /'/;
$BATINCLUDE gams2txt EXPORT
PUT '/;'/;
PUT 'PARAMETER IMPORT(G,*,T) Commodity imports /'/;
$BATINCLUDE gams2txt IMPORT
PUT '/;'/;
SCALAR TRACE_CHK Comparison of submatrix trace with full SAM;
TRACE_CHK = round(
SUM((J,JJ), MAKE(J,JJ) + SEXPRT(J,JJ) + USE(J,JJ) + IUSE(J,JJ) +
FD(J,JJ) + FEXPRT(J,JJ) + IMAKE(J,JJ) + FS(J,JJ) +
TRNSFER(J,JJ) + IEXPRT(J,JJ) + SIMPRT(J,JJ) +
FIMPRT(J,JJ) + IIMPRT(J,JJ) + TRNSHP(J,JJ))
- SUM((R,C), SAM(R,C)), 2);
ABORT$TRACE_CHK "Check sums do not match?",TRACE_CHK;
$TITLE A Generic IMPLAN General Equilibrium Model
* Read the current dataset:
$INCLUDE data
* Drop negligible trade flows:
EXPORT(S,G,T) = ROUND( EXPORT(S,G,T), 6);
EXPORT(I,G,T) = ROUND( EXPORT(I,G,T), 6);
IMPORT(G,S,T) = ROUND( IMPORT(G,S,T), 6);
IMPORT(G,I,T) = ROUND( IMPORT(G,I,T), 6);
PARAMETER BALANCE(*,*) Account balance check
TRDBAL(*,*,T) Commodity trade balance check
XTRNSF External transfers by institutions (inflows);
TRDBAL("EXPORT",S,T) = ROUND( SEXPRT(S,T) - SUM(G, EXPORT(S,G,T)), 4);
TRDBAL("IMPORT",S,T) = ROUND( SIMPRT(T,S) - SUM(G, IMPORT(G,S,T)), 4);
TRDBAL("EXPORT",I,T) = ROUND( IEXPRT(I,T) - SUM(G, EXPORT(I,G,T)), 4);
TRDBAL("IMPORT",I,T) = ROUND( IIMPRT(T,I) - SUM(G, IMPORT(G,I,T)), 4);
OPTION TRDBAL:0:1:1;
DISPLAY TRDBAL;
XTRNSF(I,T) = TRDBAL("EXPORT",I,T) - TRDBAL("IMPORT",I,T);
DISPLAY XTRNSF;
BALANCE(S,"PROFIT") = ROUND( SUM(G,MAKE(S,G)) + SUM(T, SEXPRT(S,T))
- SUM(G, USE(G,S)) - SUM(F, FD(F,S)) - SUM(T, SIMPRT(T,S)), 5);
BALANCE(G,"GMARKET") = ROUND( SUM(S,MAKE(S,G)) + SUM(I, IMAKE(I,G))
- SUM(S, USE(G,S)) - SUM(I, IUSE(G,I)), 5);
BALANCE(F,"FMARKET") = ROUND( SUM(I, FS(I,F)) + SUM(T, FIMPRT(T,F))
- SUM(S,FD(F,S)) - SUM(T, FEXPRT(F,T)), 5);
BALANCE(I,"INCOME") = ROUND( SUM(G, IMAKE(I,G)) + SUM(F, FS(I,F))
+ SUM(II, TRNSFER(I,II)) + SUM(T, IEXPRT(I,T))
- SUM(G, IUSE(G,I)) - SUM(II, TRNSFER(II,I))
- SUM(T, IIMPRT(T,I)), 5);
BALANCE(T,"TRADE") = ROUND( SUM(S,SEXPRT(S,T)) + SUM(F,FEXPRT(F,T))
+ SUM(I, IEXPRT(I,T)) + SUM(TT, TRNSHP(TT,T))
- SUM(S, SIMPRT(T,S)) - SUM(F, FIMPRT(T,F))
- SUM(I, IIMPRT(T,I)) - SUM(TT, TRNSHP(T,TT)), 5);
DISPLAY BALANCE;
PARAMETER SHARES(S,*) Value shares in production (%);
SET KL(F) Capital-labor inputs /EMPL,PROP,OTHP/;
SHARES(S,"KL")$(SUM(G,MAKE(S,G)) + SUM(T, SEXPRT(S,T)))
= ROUND(100 * SUM(KL,FD(KL,S)) /
(SUM(G,MAKE(S,G)) + SUM(T, SEXPRT(S,T))) );
SHARES(S,T)$(SUM(G,MAKE(S,G)) + SUM(TT, SEXPRT(S,TT)))
= ROUND(100 * SIMPRT(T,S) /
(SUM(G,MAKE(S,G)) + SUM(TT, SEXPRT(S,TT))) );
SHARES(S,"L/KL")$SUM(KL,FD(KL,S))
= ROUND(100 * FD("EMPL",S)/SUM(KL,FD(KL,S)) );
SHARES(S,"L(S)/L") = ROUND(100 * FD("EMPL",S) / SUM(SS,FD("EMPL",SS)));
OPTION SHARES:0;
DISPLAY SHARES;
PARAMETER NV(*,*) Negative entries;
NV(S,G) = ROUND( MIN(0, MAKE(S,G)), 4);
IF (SUM((S,G)$NV(S,G), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY MAKE(S,G):", NV;
NV(S,G) = 0;
);
NV(S,T) = ROUND( MIN(0, SEXPRT(S,T)), 4);
IF (SUM((S,T)$NV(S,T), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY SEXPRT(S,T):", NV;
NV(S,T) = 0;
);
NV(G,S) = ROUND( MIN(0, USE(G,S)), 4);
IF (SUM((G,S)$NV(G,S), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY USE(G,S):", NV;
NV(G,S) = 0;
);
NV(G,I) = ROUND( MIN(0, IUSE(G,I)), 4);
IF (SUM((G,I)$NV(G,I), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY IUSE(G,I):", NV;
NV(G,I) = 0;
);
NV(F,S) = ROUND( MIN(0, FD(F,S)), 4);
IF (SUM((F,S)$NV(F,S), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY FD(F,S):", NV;
NV(F,S) = 0;
);
NV(F,T) = ROUND( MIN(0, FEXPRT(F,T)), 4);
IF (SUM((F,T)$NV(F,T), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY FEXPRT(F,T):", NV;
NV(F,T) = 0;
);
NV(I,G) = ROUND( MIN(0, IMAKE(I,G)), 4);
IF (SUM((I,G)$NV(I,G), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY IMAKE(I,G):", NV;
NV(I,G) = 0;
);
NV(I,F) = ROUND( MIN(0, FS(I,F)), 4);
IF (SUM((I,F)$NV(I,F), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY FS(I,F):", NV;
NV(I,F) = 0;
);
NV(I,II) = ROUND( MIN(0, TRNSFER(I,II)), 4);
IF (SUM((I,II)$NV(I,II), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY TRNSFER(I,II):", NV;
NV(I,II) = 0;
);
NV(I,T) = ROUND( MIN(0, IEXPRT(I,T)), 4);
IF (SUM((I,T)$NV(I,T), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY IEXPRT(I,T):", NV;
NV(I,T) = 0;
);
NV(T,S) = ROUND( MIN(0, SIMPRT(T,S)), 4);
IF (SUM((T,S)$NV(T,S), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY SIMPRT(T,S):", NV;
NV(T,S) = 0;
);
NV(T,F) = ROUND( MIN(0, FIMPRT(T,F)), 4);
IF (SUM((T,F)$NV(T,F), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY FIMPRT(T,F):", NV;
NV(T,F) = 0;
);
NV(T,I) = ROUND( MIN(0, IIMPRT(T,I)), 4);
IF (SUM((T,I)$NV(T,I), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY IIMPRT(T,I):", NV;
NV(T,I) = 0;
);
NV(T,TT) = ROUND( MIN(0, TRNSHP(T,TT)), 4);
IF (SUM((T,TT)$NV(T,TT), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY TRNSHP(T,TT):", NV;
NV(T,TT) = 0;
);
NV(G,T) = ROUND( MIN(0, SMIN(S,EXPORT(S,G,T)), SMIN(I,EXPORT(I,G,T)) ), 4);
IF (SUM((G,T)$NV(G,T), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY EXPORT(*,G,T):", NV;
NV(G,T) = 0;
);
NV(G,T) = ROUND( MIN(0, SMIN(S,IMPORT(G,S,T)), SMIN(I,IMPORT(G,I,T))), 4);
IF (SUM((G,T)$NV(G,T), 1),
DISPLAY " NEGATIVE ENTRIES FOR ARRAY IMPORT(G,*,T):", NV;
NV(G,T) = 0;
);
* Now set up the benchmark model:
PARAMETER
TRN0 Benchmark net transfers by institutions,
X0 Benchmark commodity exports,
M0 Benchmark commodity imports,
W0 Benchmark institutional USE and IMPORT,
D0 Benchmark commodity supply by industry and institutions;
TRN0(I) = SUM(II, TRNSFER(I,II)-TRNSFER(II,I));
M0(G) = SUM((S,T), IMPORT(G,S,T)) + SUM((I,T), IMPORT(G,I,T));
X0(G) = SUM((S,T), EXPORT(S,G,T)) + SUM((I,T), EXPORT(I,G,T));
W0(I) = SUM(G, IUSE(G,I) + SUM(T, IMPORT(G,I,T)) );
D0(G) = SUM(S, MAKE(S,G)) + SUM(I, IMAKE(I,G));
TRN0(I) = ROUND( TRN0(I), 6);
M0(G) = ROUND( M0(G), 6);
X0(G) = ROUND( X0(G), 6);
W0(I) = ROUND( W0(I), 6);
D0(G) = ROUND( D0(G), 6);
SET IFIX(I) Identifies institutions which have zero IUSE and IMPORT;
IFIX(I) = YES$(W0(I) EQ 0);
$ONTEXT
$MODEL:IMPLAN
$SECTORS:
Y(S) ! Sectoral production
E(S) ! Sectoral supply -- CET for export and domestic
X(G)$X0(G) ! Commodity export
M(G)$M0(G) ! Commodity import
W(I)$W0(I) ! Final demand aggregator (all institutions)
$COMMODITIES:
PY(S) ! Sectoral output price index
PF(F) ! Factor price index
PFX ! Balance of payments constraint
PD(G)$D0(G) ! Domestic supply price
PX(G)$X0(G) ! Export supply price
PM(G)$M0(G) ! Import demand price
PW(I)$W0(I) ! Final demand index (institutions)
$CONSUMERS:
RA(I)$W0(I) ! Instititutional income
FOREIGN ! Foreign factor supply agent
* Production activity:
$PROD:Y(S) s:0 VA:1 G.TL:4
O:PY(S) Q:(SUM(G,MAKE(S,G)+SUM(T,EXPORT(S,G,T))))
I:PD(G) Q:USE(G,S) G.TL:
I:PM(G) Q:(SUM(T,IMPORT(G,S,T))) G.TL:
I:PF(F) Q:FD(F,S) VA:
* Export activity:
$PROD:E(S) t:1 G.TL(t):4
O:PD(G) Q:MAKE(S,G) G.TL:
O:PX(G) Q:(SUM(T,EXPORT(S,G,T))) G.TL:
I:PY(S) Q:(SUM(G,MAKE(S,G)+SUM(T,EXPORT(S,G,T))))
* Final demand by institutions modeled as Cobb-Douglas:
$PROD:W(I)$W0(I) s:1
O:PW(I) Q:W0(I)
I:PD(G) Q:IUSE(G,I)
I:PM(G) Q:(SUM(T,IMPORT(G,I,T)))
* Commodity trade (fixed export and import prices):
$PROD:X(G)$X0(G)
O:PFX Q:X0(G)
I:PX(G) Q:X0(G)
$PROD:M(G)$M0(G)
O:PM(G) Q:M0(G)
I:PFX Q:M0(G)
* Income balance for institutions:
$DEMAND:RA(I)$W0(I)
E:PD(G) Q:IMAKE(I,G)
E:PF(F) Q:FS(I,F)
E:PX(G) Q:(SUM(T,EXPORT(I,G,T)))
E:PFX Q:(SUM(T,XTRNSF(I,T)))
E:PFX Q:TRN0(I)
D:PW(I) Q:W0(I)
* Foreign factor supply and exogenous institutions:
$DEMAND:FOREIGN
E:PD(G) Q:(SUM(IFIX,IMAKE(IFIX,G)))
E:PFX Q:(SUM((IFIX,T),IEXPRT(IFIX,T)))
E:PF(F) Q:(SUM(IFIX,FS(IFIX,F)))
E:PFX Q:(SUM(IFIX,TRN0(IFIX)))
E:PF(F) Q:(SUM(T,FIMPRT(T,F)-FEXPRT(F,T)))
D:PFX Q:(SUM((F,T),FIMPRT(T,F)))
$OFFTEXT
$SYSINCLUDE mpsgeset IMPLAN
IMPLAN.ITERLIM = 0;
$INCLUDE IMPLAN.GEN
SOLVE IMPLAN USING MCP;