Exporting Data from IMPLAN to GAMS


IMPLAN Social Accounting Matrices (SAMs) have long been used as the foundation of many computable general equilibrium (CGE) models – and now it is easier than ever to incorporate IMPLAN’s SAMs into CGE models.

From the Region Details, users can export the SAM data from any Region in IMPLAN Cloud into the General Algebraic Modeling System (GAMS) format for use in CGE modeling. This article briefly discusses the difference between I-O and CGE models, then walks users through the procedure of exporting and incorporating the files into GAMS.


Social Accounting Matrices (SAMs) form the basis for both input-output (I-O) models and computable general equilibrium (CGE) models. In fact, I-O models can be characterized as a subset of CGE models that incorporate various simplifying assumptions which impose some limits (for example, assuming away input substitution, relative price changes, and supply constraints) while at the same time allowing for more detail (for example, greater geographic and industry granularity, more tax and household income categories). An additional advantage of I-O analysis over CGE is the separation of direct effects from indirect effects (Rose and Liao, 2005).  

On the other hand, due to the assumptions of fixed relative prices and implicitly perfectly elastic supply, I-O models cannot estimate the potential supply-induced displacement of other economic activity. By incorporating short-run supply constraints and adjustments in relative prices, CGE models can capture both positive multiplier effects and negative displacement effects stemming from an exogenous shock. The demand and supply responsiveness to price are governed by elasticities, which are exogenous parameters (i.e., they are not determined within the model). Their values are mostly taken from empirical studies. Often, the links between a CGE model’s parameter requirements and the elasticities available in the literature are weak (Burfisher, 2011). Additionally, because regional CGE models routinely utilize the same external substitution elasticities found in national or international models, they face skepticism in their use for regional analysis (Partridge and Rickman, 2007).   

As is the case with any model, I-O models and CGE models alike have their strengths and weaknesses, and the choice between the two ultimately hinges on the goals and needs of the analysis and the resources (time, funding, expertise) available to the analyst.  


The data files required for constructing a CGE model using GAMS can be downloaded for any Region from IMPLAN Cloud. 

From the dashboard, navigate to the Regions screen.

From the Regions screen, set the appropriate Data Year, then use the search bar, map view, or list view to select the Region of interest. Once selected, the Region will appear in the Selected Regions panel of the screen.

The underlying data about a Selected Region can be accessed by clicking on the Region card name or the View Region Details button.

In the Region Details, use the navigation ribbon to select “Export GAMS files.” A warning will appear to indicate the file is downloading. 

The compressed folder (zip file) will contain 26 nxm.dat files (where n and m are integers referring to the row and column of the SAM matrix respectively) in addition to an emp.dat file. Each Region will download a separate zip file named after the Region and Data Year. The exported files are in dollars, not in millions.



Three interrelated SAM to CGE GAMS programs CHECK.GMS, AGGREG.GMS, and MAP.GMS can be used to construct a SAM file from the 26 nxm.dat files exported from IMPLAN in GAMS. 

The CHECK.GMS program reads the IMPLAN files and calls > AGGREG.GMS which aggregates according to the sectoring scheme and calls > MAP.GMS in which the sectoring scheme is defined. 

In addition, the user files also include the GAMS2XCL.GMS, MODEL.GMS, REPORT.GMS, SAM.GMS, and SAM.GDX programs.

Due to file naming inconsistencies of the three GAMS files being used, all 26 nxm.dat files need to be renamed to include a prefix. Set the prefix to be the Data Year used, in this example 2021 followed by a space so that ‘1x2.dat’ becomes ‘2021 1x2.dat’. The prefix is added so that it can be deleted by the GAMS code subsequently as it reads the data. If prefixes are not included, GAMS will be unable to locate the files, delete them, or read the data in the files. 

Next, the CHECK.GMS file needs to be modified by the user to tell the program where to look for the renamed ‘2021 nxm.dat’ files. In particular, global variables are used to set the locations of the various directories where the programs, the input data, and the output files are located. These variables are set in CHECK.GMS. The first variable is PROGPATH which is the directory where AGGREG.GMS and MAP.GMS are located. It is also the directory where the downloaded file named MAP.GMS will be saved. It is set by altering the following line:


The next variable is called DATAPATH which sets the directory where the 26 data files created by IMPLAN are located. It is set by altering the following line: 


The next variable is called DATANAM which sets the file name suffix for all the 26 IMPLAN files. It is set by altering the following line: 


The last global variable to set is called ADJUST which allows the user to choose whether the SAM includes imports and exports of industries or commodities. Set ADJUST to NO to import and export industries/activities and set ADJUST to YES to import and export commodities. 


MAP.GMS is the file which contains the aggregation scheme. This file describes the way the unaggregated industries, commodities, factors, institutions, and government entities are to be aggregated. The user must first define a set K which names the aggregated sectors. The user must then define a set named MAP(K,R) which describes the Cartesian mapping from the set of un-aggregated sectors (R) to the set of aggregated sectors (K). (The set R is defined in CHECK.GMS. The user does not need to redefine it.) Each of the 546 Industries (named 1 to 546) must be mapped to exactly one aggregated sector listed in K. 

Similarly, each of the following sectors must be mapped to exactly one aggregated sector: 

5001, Employee Compensation 

6001, Proprietary Income 

7001, Other Property Income 

10001 – 10009, Household Income groups 1-9 

11001 – 11003, Federal Government: Non-defense, Defense, Investment 

12001 – 12004, State & Local Government: Other, Education, Hospital & Health Services, Investment 

13001, Investment: Enterprises (Corporations) 

14001 – 14002, Investment: Gross private fixed investment (Capital) & Inventory sales deletions 

25001, Foreign trade 

28001, Domestic trade 

Use the sample MAP file to see how to define this mapping. Run the programs by running CHECK.GMS. This file calls AGGREG.GMS which in turn calls MAP.GMS. The output file named SAM.GMS contains the aggregated SAM which can be included in any GMS program.


The GAMS files exported from IMPLAN Cloud can be mapped to the exported Detailed SAM as shown in Figure 1.

Figure 1. IxC SAM Diagram 











Foreign Trade


Domestic Trade

1-Industry   1x2     1x5 1x6
2-Commodity 2x1     2x4    
3-Factors 3x1          
4-Institutions   4x2 4x3 4x4 4x5 4x6
5-Foreign Trade 5x1   5x3 5x4 5x5*  
6-Domestic Trade 6x1   6x3 6x4    

Each cell in the SAM diagram represents a sub-matrix that makes up one component of the detailed SAM. Each sub-matrix is contained in a GAMS .dat file. They are labeled nxm.dat according to the SAM diagram, referenced as nxm.dat in the previous section. The dimensions of each file can be deciphered by referencing the Detailed SAM Codes for each sub-matrix code shown in Figure 2.

Figure 2. Mapping of Diagram to Detail SAM Codes

Sub-matrix Code Description Paying/Receiving Codes
1 Industry 1-546
2 Commodity 3001-3546
3 Factors 5001, 6001, 7001, 8001
4 Institutions 10001-9, 11001-3, 12001-4, 13001, 14001-2
5 Foreign Trade 25001
6 Domestic Trade 28001
In the SAM, columns make payments to rows, so the sub-matrix row (first number in file name) indicates who is receiving and the sub-matrix column (second number indicates who is paying). Using the key provided, one can generate the data in each sub-matrix .dat file with a Detailed IxC SAM exported from IMPLAN Cloud. For example, 1x2.dat contains the sub-matrix of Industry x Commodity transactions within the SAM (Commodity payments to Industries). Like in Detailed SAMs exported from IMPLAN Cloud, these transactions are listed by row as opposed to matrix form. Each row in a GAMS .dat file is formatted as:

‘ReceivingCode’.’PayingCode’ SAM Value/106

The mapping of the IxC SAM to GAMS files here maps each of the 18 sub-matrices included in the SAM diagram, corresponding to 18 of the GAMS files. In addition to these 18, the GAMS files include a file for Employment by Industry (emp.dat). The remaining 7 files provide a disaggregated version of Industry and Institution trade data by Commodity, explained further in Figure 3.

Figure 3. Mapping of Disaggregated Trade Data

File/Matrix name Data Description Correspondence to SAM Diagram
1x7 By Industry Foreign Exports 1x5 disaggregated by Commodity
1x8 By Industry Domestic Exports 1x6 disaggregated by Commodity
4x7 By Institution Foreign Exports 4x5 disaggregated by Commodity
4x8 By Institution Foreign Exports 4x6 disaggregated by Commodity
7x1 Foreign Imports by Industry 5x1 disaggregated by Commodity
7x4 Foreign Imports by Institution 5x4 disaggregated by Commodity
8x1 Domestic Imports by Industry 6x1 disaggregated by Commodity
8x4 Domestic Imports by Institution 6x4 disaggregated by Commodity

* Note, the GAMS files exported from IMPLAN Cloud and IMPLAN Pro differ slightly. In IMPLAN Cloud, the SAM payment from Foreign trade to Foreign trade is always null. Therefore, the 5x5.dat file will never contain data when produced by IMPLAN Cloud, whereas IMPLAN Pro produced a tiny value.


Burfisher, M.E. (2011). Introduction to Computable General Equilibrium Models. Cambridge: Cambridge University Press. 

Partridge, M.D. and Rickman, D.S. (2007). "CGE Modeling for Regional Economic Development Analysis," Economics Working Paper Series 0706, Oklahoma State University, Department of Economics and Legal Studies in Business. 

Rose, A. and Liao, S. (2005). Modeling Regional Economic Resilience to Disasters: A Computable General Equilibrium Analysis of Water Service Disruptions. Journal of Regional Science 45(1): 75-112.  

Stodick, L. & Cooke, S. (2014). Exporting Data from IMPLAN to GAMS. IMPLAN Group LLC. https://support.implan.com/hc/article_attachments/360052942714/GAMS_Exporting_Data_from_IMPLAN__to_GAMS_7_1_2014.pdf


Summary Description of Elements of the IxC and IxI Social Accounting Matrix

National Structural Matrix


Written August 30, 2023